@withpica/mcp-server
Version:
MCP Server for withPICA — enables AI assistants to interact with your withPICA music catalog
91 lines • 4.91 kB
JavaScript
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
import { formatSuccess } from "@withpica/mcp-utils";
export class ComparisonTools {
pica;
constructor(pica) {
this.pica = pica;
}
getTools() {
return [
{
definition: {
name: "pica_enrichment_compare",
scope: "read:catalog",
audiences: ["stdio", "http", "public"],
tier: "read",
description: "Compare enrichment source data vs catalog for a work or person. " +
"Returns a side-by-side comparison showing what each source (MusicBrainz, MLC, Spotify, " +
"YouTube, Discogs, ISNI) has vs what's in the catalog, with match status and suggested actions. " +
"Use this to identify gaps, discrepancies, and enrichment opportunities. " +
"Prefer pica_enrichment_candidates to find which works and people have gaps; this one compares one entity.",
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: {
entity_type: {
type: "string",
description: "Type of entity to compare",
enum: ["work", "person"],
},
entity_id: {
type: "string",
description: "Work ID or Person ID",
},
},
required: ["entity_type", "entity_id"],
},
},
executor: this.enrichmentCompare.bind(this),
},
{
definition: {
name: "pica_registrations_compare",
scope: "read:catalog",
audiences: ["stdio", "http", "public"],
tier: "read",
description: "Compare registration status across PROs (PRS, MCPS, PPL, VPL) for a work. " +
"Returns which PROs the work is registered with, registration dates/IDs, and " +
"suggested actions for missing registrations. Also identifies cascade opportunities " +
"(e.g. ISRC available → PPL registration is ready).",
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: {
work_id: {
type: "string",
description: "Work ID to check registrations for",
},
},
required: ["work_id"],
},
},
executor: this.registrationsCompare.bind(this),
},
];
}
async enrichmentCompare(args) {
const result = await this.pica.comparisons.enrichmentCompare({
entityType: args.entity_type,
entityId: args.entity_id,
});
// SDK request() unwraps data.data, so result is the inner object directly
const data = result;
const fieldCount = data.fields?.length || 0;
const fieldsWithValue = data.fields?.filter((f) => f.currentValue != null).length || 0;
const actionCount = data.suggestedActions?.length || 0;
return formatSuccess(`Enrichment comparison for "${data.title}": ${fieldsWithValue}/${fieldCount} fields populated. ${actionCount} suggested action${actionCount !== 1 ? "s" : ""}.`, result);
}
async registrationsCompare(args) {
const result = await this.pica.comparisons.registrationsCompare(args.work_id);
const data = result;
const registeredCount = data.registrations?.filter((r) => r.registered === true).length || 0;
const totalPros = data.registrations?.length || 0;
const actionCount = data.suggestedActions?.length || 0;
return formatSuccess(`Registration status for "${data.title}": ${registeredCount}/${totalPros} PROs registered. ${actionCount} suggested action${actionCount !== 1 ? "s" : ""}.`, result);
}
}
//# sourceMappingURL=comparisons.js.map