@withpica/mcp-server-directory 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +4 -3
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +28 -1
- package/dist/client.js.map +1 -1
- package/dist/lib/changelog.generated.d.ts +2 -2
- package/dist/lib/changelog.generated.d.ts.map +1 -1
- package/dist/lib/changelog.generated.js +2 -2
- package/dist/lib/changelog.generated.js.map +1 -1
- package/dist/prompts/index.js +1 -1
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/public-question-atlas.d.ts.map +1 -1
- package/dist/prompts/public-question-atlas.js +14 -0
- package/dist/prompts/public-question-atlas.js.map +1 -1
- package/dist/resources/llms-primer.d.ts +1 -1
- package/dist/resources/llms-primer.d.ts.map +1 -1
- package/dist/resources/llms-primer.js +6 -2
- package/dist/resources/llms-primer.js.map +1 -1
- package/dist/skills/skills.generated.js +1 -1
- package/dist/skills/skills.generated.js.map +1 -1
- package/dist/tools/enquiries.d.ts +19 -0
- package/dist/tools/enquiries.d.ts.map +1 -0
- package/dist/tools/enquiries.js +190 -0
- package/dist/tools/enquiries.js.map +1 -0
- package/dist/tools/index.d.ts +4 -3
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js +17 -1
- package/dist/tools/works.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/prompts/prompt-eval-harness.test.ts +3 -2
- package/src/__tests__/tools/composability-chains.test.ts +2 -2
- package/src/__tests__/tools/enquiries.test.ts +135 -0
- package/src/__tests__/tools/works.test.ts +3 -0
- package/src/client.ts +37 -1
- package/src/prompts/index.ts +1 -1
- package/src/prompts/public-question-atlas.ts +15 -0
- package/src/resources/llms-primer.ts +6 -2
- package/src/skills/find-music-for-sync-brief/SKILL.md +1 -1
- package/src/skills/skills.generated.ts +1 -1
- package/src/tools/enquiries.ts +210 -0
- package/src/tools/index.ts +6 -3
- package/src/tools/works.ts +19 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
const PROJECT_TYPES = [
|
|
3
|
+
"film",
|
|
4
|
+
"tv series",
|
|
5
|
+
"commercial",
|
|
6
|
+
"trailer",
|
|
7
|
+
"video game",
|
|
8
|
+
"podcast",
|
|
9
|
+
"social media",
|
|
10
|
+
"other",
|
|
11
|
+
];
|
|
12
|
+
/** The enquiry route answers `{ error: "…" }` or `{ error: { message } }`. */
|
|
13
|
+
function errorMessage(json) {
|
|
14
|
+
const e = json?.error;
|
|
15
|
+
if (typeof e === "string")
|
|
16
|
+
return e;
|
|
17
|
+
if (e && typeof e.message === "string")
|
|
18
|
+
return e.message;
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The route stores the enquiry and THEN sends the emails, so a 5xx or a lost
|
|
23
|
+
* answer can come after it was stored. Saying "not sent" there would invite a
|
|
24
|
+
* resend, and a second enquiry and email to the owner.
|
|
25
|
+
*/
|
|
26
|
+
function outcomeUnknown(detail) {
|
|
27
|
+
const reason = "Outcome unknown: the enquiry may already have reached the owner. " +
|
|
28
|
+
"Do not resend without checking with the user first.";
|
|
29
|
+
return {
|
|
30
|
+
content: [{ type: "text", text: `${reason} (${detail})` }],
|
|
31
|
+
structuredContent: { sent: null, outcome: "unknown", reason, detail },
|
|
32
|
+
isError: true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The directory's only non-read tool: send a licensing enquiry to the owner
|
|
37
|
+
* of a work listed in the public directory. It goes through the same public
|
|
38
|
+
* route as the directory's web form (POST /api/shop/license-enquiries), so
|
|
39
|
+
* the same rules apply: the work must be listed, the owner must not have
|
|
40
|
+
* switched enquiries off, and a budget is optional.
|
|
41
|
+
*/
|
|
42
|
+
export class DirectoryEnquiryTools {
|
|
43
|
+
client;
|
|
44
|
+
constructor(client) {
|
|
45
|
+
this.client = client;
|
|
46
|
+
}
|
|
47
|
+
getTools() {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
definition: {
|
|
51
|
+
name: "directory_send_licensing_enquiry",
|
|
52
|
+
tier: "write",
|
|
53
|
+
description: "Use when the user asks: 'ask the owner if I can license this', " +
|
|
54
|
+
"'send a licensing enquiry for X', 'contact the rights holder about using this song'. " +
|
|
55
|
+
"Sends a licensing enquiry to the owner of a work listed in the public directory. " +
|
|
56
|
+
"The enquiry is passed to the owner, who can reply to the user by email (the user's address is " +
|
|
57
|
+
"shared with them); a confirmation email to the user is usually sent but not guaranteed. " +
|
|
58
|
+
"Nothing is agreed or priced: it only opens the conversation. " +
|
|
59
|
+
"ONLY call after the user has explicitly asked to send it and has given their own name, " +
|
|
60
|
+
"email and a description of the project. Never invent these, and never send on their behalf " +
|
|
61
|
+
"without asking. Get work_id from directory_lookup_work, directory_list_works or directory_chain. " +
|
|
62
|
+
"A 403 means the owner is not taking enquiries; a 404 means the work is not publicly listed; " +
|
|
63
|
+
"an unknown outcome means it may already have been sent, so never resend without asking. " +
|
|
64
|
+
"NOT FOR: looking up who owns a song (use directory_lookup_work). " +
|
|
65
|
+
"→ then: directory_lookup_work (the work page and credits, to share with the user)",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
properties: {
|
|
69
|
+
work_id: {
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "The work's UUID from the directory.",
|
|
72
|
+
},
|
|
73
|
+
contact_name: {
|
|
74
|
+
type: "string",
|
|
75
|
+
description: "The user's own name, as they gave it.",
|
|
76
|
+
},
|
|
77
|
+
contact_email: {
|
|
78
|
+
type: "string",
|
|
79
|
+
description: "The user's own email address. The owner will reply to it.",
|
|
80
|
+
},
|
|
81
|
+
company_name: {
|
|
82
|
+
type: "string",
|
|
83
|
+
description: "The user's company or production (optional).",
|
|
84
|
+
},
|
|
85
|
+
project_type: {
|
|
86
|
+
type: "string",
|
|
87
|
+
enum: PROJECT_TYPES,
|
|
88
|
+
description: "The kind of project.",
|
|
89
|
+
},
|
|
90
|
+
project_description: {
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "How the music would be used, in the user's words.",
|
|
93
|
+
},
|
|
94
|
+
territory: {
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "Where it would be used (optional; omit if the user didn't say).",
|
|
97
|
+
},
|
|
98
|
+
term: {
|
|
99
|
+
type: "string",
|
|
100
|
+
description: "For how long (optional; omit if the user didn't say).",
|
|
101
|
+
},
|
|
102
|
+
budget_amount: {
|
|
103
|
+
type: "number",
|
|
104
|
+
description: "Proposed fee, only if the user named one (optional).",
|
|
105
|
+
},
|
|
106
|
+
budget_currency: {
|
|
107
|
+
type: "string",
|
|
108
|
+
description: "Three-letter currency code (default GBP).",
|
|
109
|
+
},
|
|
110
|
+
budget_notes: {
|
|
111
|
+
type: "string",
|
|
112
|
+
description: "Anything the user said about budget that isn't a single amount, e.g. a range.",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
required: [
|
|
116
|
+
"work_id",
|
|
117
|
+
"contact_name",
|
|
118
|
+
"contact_email",
|
|
119
|
+
"project_type",
|
|
120
|
+
"project_description",
|
|
121
|
+
],
|
|
122
|
+
additionalProperties: false,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
executor: this.sendEnquiry.bind(this),
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
async sendEnquiry(args) {
|
|
130
|
+
const workId = String(args.work_id ?? "");
|
|
131
|
+
let answer;
|
|
132
|
+
try {
|
|
133
|
+
answer = await this.client.sendLicensingEnquiry({
|
|
134
|
+
workId,
|
|
135
|
+
contactName: args.contact_name,
|
|
136
|
+
contactEmail: args.contact_email,
|
|
137
|
+
companyName: args.company_name,
|
|
138
|
+
projectType: args.project_type,
|
|
139
|
+
projectDescription: args.project_description,
|
|
140
|
+
// Not specified is said plainly, never guessed.
|
|
141
|
+
territory: args.territory || "not specified",
|
|
142
|
+
duration: args.term || "not specified",
|
|
143
|
+
proposedBudgetAmount: typeof args.budget_amount === "number" ? args.budget_amount : null,
|
|
144
|
+
proposedBudgetCurrency: args.budget_currency || "GBP",
|
|
145
|
+
budgetNotes: args.budget_notes,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
// No answer at all (timeout, network): the route may still have stored it.
|
|
150
|
+
return outcomeUnknown(err.message);
|
|
151
|
+
}
|
|
152
|
+
const { status, json } = answer;
|
|
153
|
+
const page = this.client.workPageUrl(workId);
|
|
154
|
+
if (status >= 200 && status < 300 && json?.data?.id) {
|
|
155
|
+
return {
|
|
156
|
+
content: [
|
|
157
|
+
{
|
|
158
|
+
type: "text",
|
|
159
|
+
text: `Enquiry passed to the owner (reference ${json.data.id}). ` +
|
|
160
|
+
`They can reply to ${args.contact_email} if they want to take it further; ` +
|
|
161
|
+
`nothing has been agreed. Work page: ${page}`,
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
structuredContent: {
|
|
165
|
+
sent: true,
|
|
166
|
+
enquiry_id: json.data.id,
|
|
167
|
+
status: json.data.status,
|
|
168
|
+
work_page_url: page,
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// A 5xx, or a 2xx without the reference, may have stored the enquiry.
|
|
173
|
+
if (status >= 500 || (status >= 200 && status < 300))
|
|
174
|
+
return outcomeUnknown(`HTTP ${status}`);
|
|
175
|
+
const reason = status === 403
|
|
176
|
+
? "The owner is not taking licensing enquiries for this work."
|
|
177
|
+
: status === 404
|
|
178
|
+
? "That work is not listed in the public directory."
|
|
179
|
+
: status === 429
|
|
180
|
+
? "Too many enquiries were sent recently. Try again later."
|
|
181
|
+
: (errorMessage(json) ??
|
|
182
|
+
`The enquiry was not sent (HTTP ${status}).`);
|
|
183
|
+
return {
|
|
184
|
+
content: [{ type: "text", text: `Not sent. ${reason}` }],
|
|
185
|
+
structuredContent: { sent: false, http_status: status, reason },
|
|
186
|
+
isError: true,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=enquiries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enquiries.js","sourceRoot":"","sources":["../../src/tools/enquiries.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAK7D,MAAM,aAAa,GAAG;IACpB,MAAM;IACN,WAAW;IACX,YAAY;IACZ,SAAS;IACT,YAAY;IACZ,SAAS;IACT,cAAc;IACd,OAAO;CACR,CAAC;AAEF,8EAA8E;AAC9E,SAAS,YAAY,CAAC,IAAS;IAC7B,MAAM,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC;IACtB,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC,OAAO,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,MAAc;IACpC,MAAM,MAAM,GACV,mEAAmE;QACnE,qDAAqD,CAAC;IACxD,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,MAAM,GAAG,EAAE,CAAC;QAC1D,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE;QACrE,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qBAAqB;IACxB,MAAM,CAAkB;IAEhC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;I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;SACd,CAAC;IACJ,CAAC;CACF"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { DirectoryClient } from "../client.js";
|
|
2
2
|
/**
|
|
3
3
|
* ADR-230 — authority tier on every directory_* tool. Sister of the
|
|
4
|
-
* creator + team MCP's `Tier` declaration. Every directory tool is
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* creator + team MCP's `Tier` declaration. Every directory tool is `read`
|
|
5
|
+
* (public catalogue lookup) except directory_send_licensing_enquiry
|
|
6
|
+
* (`write`, tools/enquiries.ts), which sends an enquiry through the same
|
|
7
|
+
* public route as the directory's web form.
|
|
7
8
|
*/
|
|
8
9
|
export type Tier = "read" | "draft" | "write" | "destructive";
|
|
9
10
|
export interface ToolDefinition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAW/C;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEvE,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAGX;gBAEU,MAAM,EAAE,eAAe;IAqBnC,SAAS,IAAI,cAAc,EAAE;IAIvB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;CAgBzE"}
|
package/dist/tools/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { DirectoryRecordingsTools } from "./recordings.js";
|
|
|
6
6
|
import { DirectoryChainTools } from "./chain.js";
|
|
7
7
|
import { DirectorySkillsTools } from "./skills.js";
|
|
8
8
|
import { DirectoryReleaseNotesTools } from "./release-notes.js";
|
|
9
|
+
import { DirectoryEnquiryTools } from "./enquiries.js";
|
|
9
10
|
import { formatError, logError, ToolExecutionError } from "../utils/errors.js";
|
|
10
11
|
export class ToolRegistry {
|
|
11
12
|
tools;
|
|
@@ -19,6 +20,7 @@ export class ToolRegistry {
|
|
|
19
20
|
new DirectoryChainTools(client),
|
|
20
21
|
new DirectorySkillsTools(),
|
|
21
22
|
new DirectoryReleaseNotesTools(client),
|
|
23
|
+
new DirectoryEnquiryTools(client),
|
|
22
24
|
];
|
|
23
25
|
for (const group of groups) {
|
|
24
26
|
for (const tool of group.getTools()) {
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src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;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"works.d.ts","sourceRoot":"","sources":["../../src/tools/works.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1D,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,EAAE,eAAe;IAInC,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YA2G3D,SAAS;YA2BT,UAAU;
|
|
1
|
+
{"version":3,"file":"works.d.ts","sourceRoot":"","sources":["../../src/tools/works.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1D,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,EAAE,eAAe;IAInC,QAAQ,IAAI,KAAK,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;YA2G3D,SAAS;YA2BT,UAAU;YA4HV,UAAU;CAYzB"}
|
package/dist/tools/works.js
CHANGED
|
@@ -227,10 +227,26 @@ export class DirectoryWorksTools {
|
|
|
227
227
|
}
|
|
228
228
|
lines.push("");
|
|
229
229
|
}
|
|
230
|
+
// How to reach the owner. Enquiries are opt-out (only an explicit false
|
|
231
|
+
// closes them), the same test the enquiry route applies.
|
|
232
|
+
const workId = data.work_id || data.id;
|
|
233
|
+
const pageUrl = workId ? this.client.workPageUrl(workId) : undefined;
|
|
234
|
+
const enquiriesOpen = data.contact_enabled !== false;
|
|
235
|
+
lines.push("### Licensing");
|
|
236
|
+
if (pageUrl)
|
|
237
|
+
lines.push(`- Work page: ${pageUrl}`);
|
|
238
|
+
lines.push(enquiriesOpen && workId
|
|
239
|
+
? `- Enquiries open: with the user's go-ahead, send one via directory_send_licensing_enquiry (work_id ${workId}).`
|
|
240
|
+
: "- The owner is not taking licensing enquiries for this work.");
|
|
241
|
+
lines.push("");
|
|
230
242
|
const markdown = lines.join("\n");
|
|
231
243
|
return {
|
|
232
244
|
content: [{ type: "text", text: markdown }],
|
|
233
|
-
structuredContent:
|
|
245
|
+
structuredContent: {
|
|
246
|
+
...data,
|
|
247
|
+
work_page_url: pageUrl ?? null,
|
|
248
|
+
enquiries_open: enquiriesOpen && Boolean(workId),
|
|
249
|
+
},
|
|
234
250
|
};
|
|
235
251
|
}
|
|
236
252
|
async lookupIsrc(args) {
|
package/dist/tools/works.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"works.js","sourceRoot":"","sources":["../../src/tools/works.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,OAAO,mBAAmB;IACtB,MAAM,CAAkB;IAEhC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,QAAQ;QACN,OAAO;YACL;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,sBAAsB;oBAC5B,IAAI,EAAE,MAAM;oBACZ,WAAW,EACT,yEAAyE;wBACzE,qDAAqD;wBACrD,yEAAyE;wBACzE,uGAAuG;wBACvG,gEAAgE;wBAChE,qEAAqE;oBACvE,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,CAAC,EAAE;gCACD,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,gDAAgD;6BAC9D;4BACD,IAAI,EAAE;gCACJ,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,uCAAuC;6BACrD;4BACD,IAA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C3C,iBAAiB,EAAE;gBACjB,GAAI,IAAgC;gBACpC,aAAa,EAAE,OAAO,IAAI,IAAI;gBAC9B,cAAc,EAAE,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;aACjD;SACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,IAAyB;QAChD,MAAM,QAAQ,GAAQ,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE;YACxD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,GAAG;SACZ,CAAC,CAAC;QAEH,OAAO,oBAAoB,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,EAAE,MAAM,EAAE;YACvD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,QAAQ,CAAC,UAAU,EAAE,KAAK,IAAI,CAAC;SACvC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@withpica/mcp-server-directory",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "MCP Server for the withPICA Public Directory — enables AI assistants to search verified works and creators",
|
|
5
5
|
"homepage": "https://withpica.com/connect",
|
|
6
6
|
"bugs": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"bin": {
|
|
12
|
-
"pica-directory-mcp": "
|
|
12
|
+
"pica-directory-mcp": "dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"prebuild": "tsx scripts/build-changelog.ts && tsx scripts/build-skills.ts",
|
|
@@ -273,10 +273,11 @@ describe("Prompt Eval Harness — Directory MCP", () => {
|
|
|
273
273
|
expect(noTools).toEqual([]);
|
|
274
274
|
});
|
|
275
275
|
|
|
276
|
-
it("directory-autopilot is read-only
|
|
276
|
+
it("directory-autopilot says the catalogue is read-only and the one write needs the user's say-so", async () => {
|
|
277
277
|
const result = await registry.getPrompt("directory-autopilot");
|
|
278
278
|
const text = result.messages[0].content.text;
|
|
279
|
-
expect(text).toMatch(/read-only/i);
|
|
279
|
+
expect(text).toMatch(/catalogue is read-only/i);
|
|
280
|
+
expect(text).toMatch(/only if you ask/i);
|
|
280
281
|
});
|
|
281
282
|
});
|
|
282
283
|
});
|
|
@@ -39,8 +39,8 @@ describe("Directory Composability Chains", () => {
|
|
|
39
39
|
allNames = new Set(allTools.map((t) => t.name));
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
it("all
|
|
43
|
-
expect(allTools).toHaveLength(
|
|
42
|
+
it("all 12 tools are registered (parity with lib/constants/mcp-surface.ts is enforced by tool-count-parity.test.ts)", () => {
|
|
43
|
+
expect(allTools).toHaveLength(12);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it("all tools have composability chains", () => {
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Withpica Ltd. All rights reserved.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* directory_send_licensing_enquiry — agents browsing the public directory had
|
|
5
|
+
* no way to reach an owner; the sync skill told them to "contact the rights
|
|
6
|
+
* holder via the credits summary" (brief 2026-09-25).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
|
|
10
|
+
import { DirectoryEnquiryTools } from "../../tools/enquiries";
|
|
11
|
+
import { DirectoryClient } from "../../client";
|
|
12
|
+
|
|
13
|
+
const WORK = "11111111-2222-4333-8444-555555555555";
|
|
14
|
+
|
|
15
|
+
describe("directory_send_licensing_enquiry", () => {
|
|
16
|
+
let client: jest.Mocked<DirectoryClient>;
|
|
17
|
+
let tool: ReturnType<DirectoryEnquiryTools["getTools"]>[number];
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
client = {
|
|
21
|
+
sendLicensingEnquiry: jest.fn(),
|
|
22
|
+
workPageUrl: jest.fn(
|
|
23
|
+
(id: string) => `https://withpica.com/directory/works/${id}`,
|
|
24
|
+
),
|
|
25
|
+
} as any;
|
|
26
|
+
tool = new DirectoryEnquiryTools(client).getTools()[0];
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const args = {
|
|
30
|
+
work_id: WORK,
|
|
31
|
+
contact_name: "Jane Doe",
|
|
32
|
+
contact_email: "jane@films.test",
|
|
33
|
+
project_type: "film",
|
|
34
|
+
project_description: "opening titles",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
it("is the one write-tier directory tool and requires the user's own details", () => {
|
|
38
|
+
expect(tool.definition.tier).toBe("write");
|
|
39
|
+
expect(tool.definition.inputSchema.required).toEqual([
|
|
40
|
+
"work_id",
|
|
41
|
+
"contact_name",
|
|
42
|
+
"contact_email",
|
|
43
|
+
"project_type",
|
|
44
|
+
"project_description",
|
|
45
|
+
]);
|
|
46
|
+
expect(tool.definition.inputSchema.required).not.toContain("budget_amount");
|
|
47
|
+
expect(tool.definition.description).toMatch(/ONLY call after the user/);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("maps to the public enquiry body, says 'not specified' for what the user didn't give, and returns the work page", async () => {
|
|
51
|
+
client.sendLicensingEnquiry.mockResolvedValue({
|
|
52
|
+
status: 200,
|
|
53
|
+
json: { success: true, data: { id: "enq-1", status: "pending" } },
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const result = await tool.executor(args);
|
|
57
|
+
|
|
58
|
+
expect(client.sendLicensingEnquiry).toHaveBeenCalledWith(
|
|
59
|
+
expect.objectContaining({
|
|
60
|
+
workId: WORK,
|
|
61
|
+
contactName: "Jane Doe",
|
|
62
|
+
contactEmail: "jane@films.test",
|
|
63
|
+
territory: "not specified",
|
|
64
|
+
duration: "not specified",
|
|
65
|
+
proposedBudgetAmount: null,
|
|
66
|
+
proposedBudgetCurrency: "GBP",
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
|
+
expect(result.isError).toBeUndefined();
|
|
70
|
+
expect(result.structuredContent).toEqual({
|
|
71
|
+
sent: true,
|
|
72
|
+
enquiry_id: "enq-1",
|
|
73
|
+
status: "pending",
|
|
74
|
+
work_page_url: `https://withpica.com/directory/works/${WORK}`,
|
|
75
|
+
});
|
|
76
|
+
expect(result.content[0].text).toContain("nothing has been agreed");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it.each([
|
|
80
|
+
[403, /not taking licensing enquiries/],
|
|
81
|
+
[404, /not listed in the public directory/],
|
|
82
|
+
[429, /Too many enquiries/],
|
|
83
|
+
])("reports HTTP %i as not sent, with the reason", async (status, text) => {
|
|
84
|
+
client.sendLicensingEnquiry.mockResolvedValue({
|
|
85
|
+
status,
|
|
86
|
+
json: { success: false, error: { code: "X", message: "x" } },
|
|
87
|
+
});
|
|
88
|
+
const result = await tool.executor(args);
|
|
89
|
+
expect(result.isError).toBe(true);
|
|
90
|
+
expect(result.structuredContent).toMatchObject({
|
|
91
|
+
sent: false,
|
|
92
|
+
http_status: status,
|
|
93
|
+
});
|
|
94
|
+
expect(result.content[0].text).toMatch(text);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Review finding: the route stores, THEN emails. A 5xx or a lost answer can
|
|
98
|
+
// follow a stored enquiry, so "not sent" would invite a duplicate.
|
|
99
|
+
it.each([500, 502])(
|
|
100
|
+
"reports HTTP %i as an unknown outcome, not 'not sent'",
|
|
101
|
+
async (status) => {
|
|
102
|
+
client.sendLicensingEnquiry.mockResolvedValue({ status, json: null });
|
|
103
|
+
const result = await tool.executor(args);
|
|
104
|
+
expect(result.structuredContent).toMatchObject({
|
|
105
|
+
sent: null,
|
|
106
|
+
outcome: "unknown",
|
|
107
|
+
});
|
|
108
|
+
expect(result.content[0].text).toMatch(/Do not resend/);
|
|
109
|
+
expect(result.content[0].text).not.toMatch(/^Not sent/);
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
it("reports a timeout as an unknown outcome", async () => {
|
|
114
|
+
client.sendLicensingEnquiry.mockRejectedValue(
|
|
115
|
+
new Error("Request timed out after 15000ms: POST x"),
|
|
116
|
+
);
|
|
117
|
+
const result = await tool.executor(args);
|
|
118
|
+
expect(result.structuredContent).toMatchObject({ outcome: "unknown" });
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("passes a 400's own message through", async () => {
|
|
122
|
+
client.sendLicensingEnquiry.mockResolvedValue({
|
|
123
|
+
status: 400,
|
|
124
|
+
json: {
|
|
125
|
+
success: false,
|
|
126
|
+
error: {
|
|
127
|
+
code: "ENQUIRY_EMAIL_INVALID",
|
|
128
|
+
message: "Invalid email format",
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
const result = await tool.executor(args);
|
|
133
|
+
expect(result.content[0].text).toContain("Invalid email format");
|
|
134
|
+
});
|
|
135
|
+
});
|
|
@@ -18,6 +18,9 @@ describe("DirectoryWorksTools", () => {
|
|
|
18
18
|
beforeEach(() => {
|
|
19
19
|
mockClient = {
|
|
20
20
|
request: jest.fn(),
|
|
21
|
+
workPageUrl: jest.fn(
|
|
22
|
+
(id: string) => `https://withpica.com/directory/works/${id}`,
|
|
23
|
+
),
|
|
21
24
|
} as any;
|
|
22
25
|
|
|
23
26
|
worksTools = new DirectoryWorksTools(mockClient);
|
package/src/client.ts
CHANGED
|
@@ -37,7 +37,9 @@ export class DirectoryClient {
|
|
|
37
37
|
return await fetch(url, { ...init, signal: controller.signal });
|
|
38
38
|
} catch (err: any) {
|
|
39
39
|
if (err.name === "AbortError") {
|
|
40
|
-
throw new Error(
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Request timed out after ${timeoutMs}ms: ${init.method ?? "GET"} ${url}`,
|
|
42
|
+
);
|
|
41
43
|
}
|
|
42
44
|
throw err;
|
|
43
45
|
} finally {
|
|
@@ -45,6 +47,40 @@ export class DirectoryClient {
|
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
/** The public page for a directory work, for a human to open. */
|
|
51
|
+
workPageUrl(workId: string): string {
|
|
52
|
+
return `${this.baseUrl}/directory/works/${encodeURIComponent(workId)}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Send a licensing enquiry through the public enquiry route (the same one
|
|
57
|
+
* the directory's web form uses). ONE attempt, never retried: a retry after
|
|
58
|
+
* a timeout or a 5xx could store the enquiry twice and email the owner
|
|
59
|
+
* twice. Resolves with the status and parsed body for every HTTP answer,
|
|
60
|
+
* so the caller can tell a refusal (400/403/404/429) from a failure;
|
|
61
|
+
* throws only when no answer arrived.
|
|
62
|
+
*/
|
|
63
|
+
async sendLicensingEnquiry(
|
|
64
|
+
body: Record<string, unknown>,
|
|
65
|
+
): Promise<{ status: number; json: any }> {
|
|
66
|
+
const url = `${this.baseUrl}/api/shop/license-enquiries`;
|
|
67
|
+
if (this.debug) console.error(`[Directory MCP] POST ${url}`);
|
|
68
|
+
const response = await this.fetchWithTimeout(
|
|
69
|
+
url,
|
|
70
|
+
{
|
|
71
|
+
method: "POST",
|
|
72
|
+
headers: {
|
|
73
|
+
Accept: "application/json",
|
|
74
|
+
"Content-Type": "application/json",
|
|
75
|
+
},
|
|
76
|
+
body: JSON.stringify(body),
|
|
77
|
+
},
|
|
78
|
+
DEFAULT_TIMEOUT_MS,
|
|
79
|
+
);
|
|
80
|
+
const json: any = await response.json().catch(() => null);
|
|
81
|
+
return { status: response.status, json };
|
|
82
|
+
}
|
|
83
|
+
|
|
48
84
|
async request<T>(path: string, params?: Record<string, string>): Promise<T> {
|
|
49
85
|
const url = new URL(`${this.baseUrl}/api/public/directory${path}`);
|
|
50
86
|
if (params) {
|
package/src/prompts/index.ts
CHANGED
|
@@ -197,7 +197,7 @@ If I want to BROWSE what's in the directory:
|
|
|
197
197
|
|
|
198
198
|
Tell me which workflow you chose and why, in one sentence. Offer alternatives.
|
|
199
199
|
|
|
200
|
-
Important:
|
|
200
|
+
Important: The directory's catalogue is read-only: I can search and look up, but I can't create or modify anything in it. The one thing I can send, and only if you ask, is a licensing enquiry to a work's owner, with your own name and email. Only works from organisations that opted into the directory are visible.`,
|
|
201
201
|
},
|
|
202
202
|
},
|
|
203
203
|
],
|
|
@@ -563,4 +563,19 @@ export const PUBLIC_ATLAS: AtlasEntry[] = [
|
|
|
563
563
|
],
|
|
564
564
|
resolves_to: { kind: "tool", name: "directory_release_notes" },
|
|
565
565
|
},
|
|
566
|
+
|
|
567
|
+
// ─────────────────────────────────────────────────────────────────
|
|
568
|
+
// Reaching an owner — the directory's one write
|
|
569
|
+
// ─────────────────────────────────────────────────────────────────
|
|
570
|
+
{
|
|
571
|
+
question: "can I license this song?",
|
|
572
|
+
synonyms: [
|
|
573
|
+
"ask the owner if I can use this",
|
|
574
|
+
"send a licensing enquiry",
|
|
575
|
+
"contact the rights holder",
|
|
576
|
+
"who do I ask to license this?",
|
|
577
|
+
"I want to use this track in my project",
|
|
578
|
+
],
|
|
579
|
+
resolves_to: { kind: "tool", name: "directory_send_licensing_enquiry" },
|
|
580
|
+
},
|
|
566
581
|
];
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
export const DIRECTORY_PRIMER = `# PICA Directory — Public Music Catalog Search
|
|
4
4
|
|
|
5
|
-
Read
|
|
5
|
+
Read access to published music catalog data, plus one write: sending a
|
|
6
|
+
licensing enquiry to a work's owner when the user asks. No authentication
|
|
7
|
+
required.
|
|
6
8
|
Works and people are only visible if the owning organisation has opted into
|
|
7
9
|
the directory.
|
|
8
10
|
|
|
@@ -17,9 +19,11 @@ research, or identifier lookup.
|
|
|
17
19
|
- Search people by name, ISNI, IPI
|
|
18
20
|
- Look up works by recording ISRC (directory_lookup_isrc)
|
|
19
21
|
- Search recordings by audio characteristics (BPM, key, mood, energy)
|
|
22
|
+
- Send a licensing enquiry to a work's owner (directory_send_licensing_enquiry),
|
|
23
|
+
only when the user asks and gives their own name, email and project
|
|
20
24
|
|
|
21
25
|
## What You Cannot Do
|
|
22
|
-
- Create, update, or delete
|
|
26
|
+
- Create, update, or delete catalogue data (the catalogue is read-only)
|
|
23
27
|
- Access unpublished works or private catalog data
|
|
24
28
|
- See financial data, agreements, or internal metadata
|
|
25
29
|
|
|
@@ -79,7 +79,7 @@ Be honest if the directory is small for a specific style — PICA's directory gr
|
|
|
79
79
|
|
|
80
80
|
## What not to do
|
|
81
81
|
|
|
82
|
-
- Don't claim to license tracks — this skill returns a shortlist, not a license.
|
|
82
|
+
- Don't claim to license tracks — this skill returns a shortlist, not a license. When the user wants to approach an owner, offer `directory_send_licensing_enquiry`, and send it only once they say yes and give their own name, email and project description. Never invent those details.
|
|
83
83
|
- Don't speculate about pricing — sync fees are negotiated per-placement
|
|
84
84
|
- Don't return results from outside the directory (no general web search, no Spotify metadata directly) — the directory is the source of truth for this skill
|
|
85
85
|
- Don't return tracks with no attested credits without flagging them as "rights chain unverified"
|