@withpica/mcp-server-directory 1.5.0 → 1.6.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 +20 -0
- package/README.md +1 -1
- package/dist/client.d.ts +16 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -1
- package/dist/config.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/public-question-atlas.d.ts.map +1 -1
- package/dist/prompts/public-question-atlas.js +3 -0
- package/dist/prompts/public-question-atlas.js.map +1 -1
- package/dist/server.d.ts +9 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +15 -5
- package/dist/server.js.map +1 -1
- package/dist/tools/chain.d.ts +2 -2
- package/dist/tools/chain.d.ts.map +1 -1
- package/dist/tools/chain.js +15 -0
- package/dist/tools/chain.js.map +1 -1
- package/dist/tools/enquiries.d.ts +2 -2
- package/dist/tools/enquiries.d.ts.map +1 -1
- package/dist/tools/enquiries.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/people.d.ts +2 -2
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/recordings.d.ts +2 -2
- package/dist/tools/recordings.d.ts.map +1 -1
- package/dist/tools/recordings.js.map +1 -1
- package/dist/tools/release-notes.d.ts +2 -2
- package/dist/tools/release-notes.d.ts.map +1 -1
- package/dist/tools/release-notes.js.map +1 -1
- package/dist/tools/search.d.ts +2 -2
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/works.d.ts +2 -2
- package/dist/tools/works.d.ts.map +1 -1
- package/dist/tools/works.js.map +1 -1
- package/dist/utils/errors.d.ts +10 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +33 -0
- package/dist/utils/errors.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/tools/chain.test.ts +34 -0
- package/src/__tests__/utils/errors.test.ts +13 -0
- package/src/client.ts +16 -1
- package/src/config.ts +12 -1
- package/src/prompts/public-question-atlas.ts +3 -0
- package/src/server.ts +19 -7
- package/src/tools/chain.ts +18 -3
- package/src/tools/enquiries.ts +3 -3
- package/src/tools/index.ts +2 -2
- package/src/tools/people.ts +3 -3
- package/src/tools/recordings.ts +3 -3
- package/src/tools/release-notes.ts +2 -2
- package/src/tools/search.ts +3 -3
- package/src/tools/works.ts +3 -3
- package/src/utils/errors.ts +40 -0
package/src/utils/errors.ts
CHANGED
|
@@ -19,6 +19,24 @@ export class ToolExecutionError extends McpServerError {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Status → code for a route refusal that carried no code of its own.
|
|
24
|
+
*
|
|
25
|
+
* ⚠️ A port of `STATUS_REFUSAL_CODES` in
|
|
26
|
+
* `mcp-server-shared/mcp-utils/src/errors.ts`. This package does not depend on
|
|
27
|
+
* `@withpica/mcp-utils` (it publishes on its own), so it cannot import the
|
|
28
|
+
* shared formatter; `scripts/__tests__/format-error-status-parity.test.ts`
|
|
29
|
+
* fails if the two tables disagree.
|
|
30
|
+
*/
|
|
31
|
+
export const STATUS_REFUSAL_CODES: Record<number, string> = {
|
|
32
|
+
400: "VALIDATION_ERROR",
|
|
33
|
+
404: "NOT_FOUND",
|
|
34
|
+
409: "CONFLICT",
|
|
35
|
+
413: "PAYLOAD_TOO_LARGE",
|
|
36
|
+
415: "UNSUPPORTED_MEDIA_TYPE",
|
|
37
|
+
422: "VALIDATION_ERROR",
|
|
38
|
+
};
|
|
39
|
+
|
|
22
40
|
export function formatError(error: any): { type: string; text: string } {
|
|
23
41
|
if (error instanceof McpServerError) {
|
|
24
42
|
return {
|
|
@@ -78,6 +96,28 @@ export function formatError(error: any): { type: string; text: string } {
|
|
|
78
96
|
};
|
|
79
97
|
}
|
|
80
98
|
|
|
99
|
+
// A code-less 4xx is still a refusal; its status names the kind. Without
|
|
100
|
+
// this it read as UNKNOWN_ERROR, the bucket for an unclassified crash (ops
|
|
101
|
+
// issue 55510879 — the same defect in the shared formatter).
|
|
102
|
+
const status = (error as { status?: unknown })?.status;
|
|
103
|
+
const statusCode =
|
|
104
|
+
typeof status === "number" ? STATUS_REFUSAL_CODES[status] : undefined;
|
|
105
|
+
if (statusCode) {
|
|
106
|
+
return {
|
|
107
|
+
type: "text",
|
|
108
|
+
text: JSON.stringify(
|
|
109
|
+
{
|
|
110
|
+
error: statusCode,
|
|
111
|
+
message: bodyMessage || rawMessage,
|
|
112
|
+
status,
|
|
113
|
+
...(bodyDetails !== undefined ? { details: bodyDetails } : {}),
|
|
114
|
+
},
|
|
115
|
+
null,
|
|
116
|
+
2,
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
81
121
|
return {
|
|
82
122
|
type: "text",
|
|
83
123
|
text: JSON.stringify(
|