@datadive-tools/mcp 0.10.0 → 0.12.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/README.md +37 -16
- package/dist/index.js +371 -63
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +29 -5
- package/dist/lib.js +371 -63
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/lib.d.ts
CHANGED
|
@@ -60,6 +60,29 @@ declare function loadConfig(env?: NodeJS.ProcessEnv): Config;
|
|
|
60
60
|
* is a one-file change (plus appending to `allTools` in tools/index.ts).
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Tool annotations with `readOnlyHint` promoted to required.
|
|
65
|
+
*
|
|
66
|
+
* The MCP spec leaves every hint optional, but the in-product connector
|
|
67
|
+
* directories (Claude's Connectors Directory, ChatGPT's apps directory) reject a
|
|
68
|
+
* server whose tools do not declare read-vs-write behaviour, and a client cannot
|
|
69
|
+
* render an approval prompt without it. Making it required here means tool #N+1
|
|
70
|
+
* cannot silently regress the listing — the compiler catches it.
|
|
71
|
+
*
|
|
72
|
+
* Write tools (`readOnlyHint: false`) must additionally declare:
|
|
73
|
+
*
|
|
74
|
+
* - `destructiveHint` — per spec only meaningful on writes; Claude always prompts on it.
|
|
75
|
+
* - `openWorldHint` — OpenAI's plugin review requires it on every write tool: `true` if
|
|
76
|
+
* the tool changes publicly visible internet state, `false` for a closed system like a
|
|
77
|
+
* customer's own DataDive account. Missing or wrong values are a named rejection cause.
|
|
78
|
+
*/
|
|
79
|
+
type RequiredToolAnnotations = ToolAnnotations & ({
|
|
80
|
+
readOnlyHint: true;
|
|
81
|
+
} | {
|
|
82
|
+
readOnlyHint: false;
|
|
83
|
+
destructiveHint: boolean;
|
|
84
|
+
openWorldHint: boolean;
|
|
85
|
+
});
|
|
63
86
|
interface HandlerContext {
|
|
64
87
|
config: Config;
|
|
65
88
|
}
|
|
@@ -76,10 +99,10 @@ interface ToolDefinition<S extends z.ZodRawShape = z.ZodRawShape> {
|
|
|
76
99
|
/** Zod raw shape (object of Zod field schemas) — passed through to MCP SDK. */
|
|
77
100
|
inputSchema: S;
|
|
78
101
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
102
|
+
* MCP behavior hints so clients can flag token-spending write tools in their
|
|
103
|
+
* approval UI. `readOnlyHint` is mandatory; write tools also set `destructiveHint`.
|
|
81
104
|
*/
|
|
82
|
-
annotations
|
|
105
|
+
annotations: RequiredToolAnnotations;
|
|
83
106
|
/** Returns the data payload to be JSON-stringified in the tool response. */
|
|
84
107
|
handler: (args: z.infer<z.ZodObject<S>>, ctx: HandlerContext) => Promise<unknown>;
|
|
85
108
|
}
|
|
@@ -94,7 +117,7 @@ interface AnyTool {
|
|
|
94
117
|
title: string;
|
|
95
118
|
description: string;
|
|
96
119
|
inputSchema: z.ZodRawShape;
|
|
97
|
-
annotations
|
|
120
|
+
annotations: RequiredToolAnnotations;
|
|
98
121
|
handler: (args: Record<string, unknown>, ctx: HandlerContext) => Promise<unknown>;
|
|
99
122
|
}
|
|
100
123
|
|
|
@@ -134,8 +157,9 @@ declare const allTools: ReadonlyArray<AnyTool>;
|
|
|
134
157
|
* Source of truth for status semantics:
|
|
135
158
|
* datadive-backend/src/external-api/auth/api-key.guard.ts (401/402 logic)
|
|
136
159
|
* datadive-backend/src/external-api/external-api-v1.controller.ts (per-route docs)
|
|
160
|
+
* datadive-backend/src/microservices/token/quota-exceeded.error.ts (QUOTA_EXCEEDED body)
|
|
137
161
|
*/
|
|
138
|
-
type ApiErrorKind = "auth" | "payment" | "forbidden" | "not_found" | "bad_request" | "rate_limit" | "server" | "network" | "http";
|
|
162
|
+
type ApiErrorKind = "auth" | "payment" | "quota" | "forbidden" | "not_found" | "bad_request" | "rate_limit" | "server" | "network" | "http";
|
|
139
163
|
declare class ApiError extends Error {
|
|
140
164
|
readonly kind: ApiErrorKind;
|
|
141
165
|
readonly status: number;
|