@withpica/mcp-server
Version:
MCP Server for withPICA — enables AI assistants to interact with your withPICA music catalog
127 lines • 5.42 kB
JavaScript
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
const VALID_STATUSES = [
"open",
"triaged",
"investigating",
"resolved",
"wont_fix",
];
export class MyReportedIssuesTools {
pica;
constructor(pica) {
this.pica = pica;
}
getTools() {
return [
{
definition: {
name: "pica_my_reported_issues",
scope: "write:feedback",
audiences: ["stdio", "http", "public"],
tier: "read",
description: "List the issues you have reported or been " +
"impacted by, with their current resolution status. Closes " +
"the loop on `pica_report_issue` — call this when the user " +
"asks 'did anyone fix that thing I reported?' or before " +
"filing a new report on what might be the same problem. " +
"Default sort is most-recently-touched first; pass `status: " +
"'resolved'` to see what's been closed, `status: 'open'` for " +
"what's still in flight. Scoped to your account by auth context — you " +
"cannot see issues from other accounts.",
workflows: "infrastructure",
vernacular_kind: "specialist",
vernacular_reason: "Specialist context; not yet covered by the Creator Question Atlas — pending telemetry-driven addition per ADR-226 Phase 4 substrate writes.",
inputSchema: {
type: "object",
properties: {
status: {
type: "string",
enum: [...VALID_STATUSES],
description: "Optional. Filter by resolution status. Omit to see everything.",
},
limit: {
type: "number",
description: "Optional. Default 25, max 100.",
},
},
},
},
executor: this.listMine.bind(this),
},
];
}
async listMine(args) {
const status = VALID_STATUSES.includes(args.status)
? args.status
: undefined;
const limit = typeof args.limit === "number" ? args.limit : undefined;
const issues = await this.pica.opsIssues.listMine({ status, limit });
if (!Array.isArray(issues) || issues.length === 0) {
return {
content: [
{
type: "text",
text: status
? `No reported issues with status=${status} for your account.`
: `No reported issues for your account.`,
},
],
structuredContent: {
kind: "pica.card.my_reported_issues",
version: 1,
data: { count: 0, issues: [] },
},
};
}
const lines = issues.slice(0, 10).map((i) => {
const tag = i.status === "resolved"
? "✓ resolved"
: i.status === "wont_fix"
? "✗ won't fix"
: i.status;
const sigPrefix = i.signature.slice(0, 8);
const summary = i.summary ?? `${i.tool_name ?? "issue"} ${i.error_code ?? ""}`.trim();
const note = (i.status === "resolved" || i.status === "wont_fix") &&
i.resolution_note
? ` — ${i.resolution_note}`
: "";
return `[${tag}] \`${sigPrefix}\` ${summary}${note}`;
});
const more = issues.length > 10
? `\n\n_+${issues.length - 10} more — pass a higher limit to see them._`
: "";
return {
content: [
{
type: "text",
text: `${issues.length} reported issue${issues.length === 1 ? "" : "s"}` +
(status ? ` with status=${status}` : "") +
`:\n\n${lines.join("\n")}${more}`,
},
],
structuredContent: {
kind: "pica.card.my_reported_issues",
version: 1,
data: {
count: issues.length,
status_filter: status ?? null,
issues: issues.map((i) => ({
id: i.id,
signature_prefix: i.signature.slice(0, 8),
kind: i.kind,
tool_name: i.tool_name,
error_code: i.error_code,
summary: i.summary,
severity: i.severity,
status: i.status,
resolved_at: i.resolved_at,
resolution_note: i.resolution_note,
first_seen_at: i.first_seen_at,
last_seen_at: i.last_seen_at,
})),
},
},
};
}
}
//# sourceMappingURL=my-reported-issues.js.map