toolcraft 0.0.145 → 0.0.147
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 +24 -0
- package/composition.json +3 -3
- package/dist/composition.json +3 -3
- package/dist/index.d.ts +12 -0
- package/dist/index.js +11 -0
- package/dist/mcp-proxy.js +2 -0
- package/dist/mcp.js +14 -6
- package/node_modules/tiny-http-mcp-server/dist/composition.json +1 -1
- package/node_modules/tiny-http-mcp-server/package.json +1 -1
- package/node_modules/tiny-mcp-client/dist/index.d.ts +1 -0
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -334,6 +334,28 @@ defineCommand({
|
|
|
334
334
|
});
|
|
335
335
|
```
|
|
336
336
|
|
|
337
|
+
MCP assumes an unannotated tool may mutate data destructively, is not safe to retry, and can
|
|
338
|
+
interact with an open world. Declare the standard hints on each MCP command so clients can present
|
|
339
|
+
the operation accurately:
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
defineCommand({
|
|
343
|
+
name: "inspect",
|
|
344
|
+
title: "Inspect deployment",
|
|
345
|
+
description: "Inspect a deployment without changing it.",
|
|
346
|
+
annotations: {
|
|
347
|
+
readOnlyHint: true,
|
|
348
|
+
destructiveHint: false,
|
|
349
|
+
idempotentHint: true,
|
|
350
|
+
openWorldHint: false
|
|
351
|
+
},
|
|
352
|
+
scope: ["mcp"],
|
|
353
|
+
params: S.Object({ deploymentId: S.String() }),
|
|
354
|
+
result: S.Object({ status: S.String() }),
|
|
355
|
+
handler: async ({ params }) => inspectDeployment(params.deploymentId)
|
|
356
|
+
});
|
|
357
|
+
```
|
|
358
|
+
|
|
337
359
|
## HTTP errors
|
|
338
360
|
|
|
339
361
|
Toolcraft exports a fixed HTTP error hierarchy for transports and generated API clients:
|
|
@@ -554,7 +576,9 @@ Toolcraft configuration is code-first. Use `defineCommand(config)` and `defineGr
|
|
|
554
576
|
### `defineCommand(config)`
|
|
555
577
|
|
|
556
578
|
- `name: string`
|
|
579
|
+
- `title?: string` — human-readable MCP display name.
|
|
557
580
|
- `description?: string`
|
|
581
|
+
- `annotations?: { title?; readOnlyHint?; destructiveHint?; idempotentHint?; openWorldHint? }` — standard MCP behavior hints passed through unchanged.
|
|
558
582
|
- `aliases?: string[]`
|
|
559
583
|
- `positional?: string[]` — parameter names mapped from CLI argv order.
|
|
560
584
|
- `params: S.Object(...)` — input schema from `toolcraft-schema`.
|
package/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.7",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.147",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.147",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
package/dist/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.7",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.147",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.147",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -95,6 +95,14 @@ export interface Renderers<TResult> {
|
|
|
95
95
|
markdown?: (result: TResult, primitives: RenderPrimitives) => string;
|
|
96
96
|
json?: (result: TResult, primitives: RenderPrimitives) => unknown;
|
|
97
97
|
}
|
|
98
|
+
/** Standard MCP hints that describe a tool's behavior to clients. */
|
|
99
|
+
export interface ToolAnnotations {
|
|
100
|
+
title?: string;
|
|
101
|
+
readOnlyHint?: boolean;
|
|
102
|
+
destructiveHint?: boolean;
|
|
103
|
+
idempotentHint?: boolean;
|
|
104
|
+
openWorldHint?: boolean;
|
|
105
|
+
}
|
|
98
106
|
export type HandlerContext<TParamsSchema extends ObjectSchema<any> = AnyObjectSchema, TSecrets extends SecretDeclarations | undefined = undefined, TServices extends object = EmptyServices> = TServices & {
|
|
99
107
|
params: Static<TParamsSchema>;
|
|
100
108
|
secrets: InferSecrets<TSecrets>;
|
|
@@ -106,7 +114,9 @@ export type HandlerContext<TParamsSchema extends ObjectSchema<any> = AnyObjectSc
|
|
|
106
114
|
};
|
|
107
115
|
export interface CommandConfig<TServices extends object, TParamsSchema extends ObjectSchema<any>, TSecrets extends SecretDeclarations | undefined, TResult> {
|
|
108
116
|
name: string;
|
|
117
|
+
title?: string;
|
|
109
118
|
description?: string;
|
|
119
|
+
annotations?: ToolAnnotations;
|
|
110
120
|
hidden?: boolean;
|
|
111
121
|
examples?: CommandExample[];
|
|
112
122
|
aliases?: string[];
|
|
@@ -138,7 +148,9 @@ export interface StreamCommandConfig<TServices extends object, TParamsSchema ext
|
|
|
138
148
|
export interface Command<TServices extends object = EmptyServices, TParamsSchema extends ObjectSchema<any> = AnyObjectSchema, TSecrets extends SecretDeclarations | undefined = undefined, TResult = unknown> {
|
|
139
149
|
kind: "command";
|
|
140
150
|
name: string;
|
|
151
|
+
title?: string;
|
|
141
152
|
description?: string;
|
|
153
|
+
annotations?: ToolAnnotations;
|
|
142
154
|
hidden: boolean;
|
|
143
155
|
examples: CommandExample[];
|
|
144
156
|
aliases: string[];
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,9 @@ function cloneRequires(requires) {
|
|
|
33
33
|
check: requires.check
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
+
function cloneToolAnnotations(annotations) {
|
|
37
|
+
return annotations === undefined ? undefined : { ...annotations };
|
|
38
|
+
}
|
|
36
39
|
function cloneStringArray(values) {
|
|
37
40
|
return values === undefined ? undefined : [...values];
|
|
38
41
|
}
|
|
@@ -291,7 +294,9 @@ function createBaseCommand(config) {
|
|
|
291
294
|
const command = {
|
|
292
295
|
kind: "command",
|
|
293
296
|
name: config.name,
|
|
297
|
+
title: config.title,
|
|
294
298
|
description: config.description,
|
|
299
|
+
annotations: cloneToolAnnotations(config.annotations),
|
|
295
300
|
hidden: config.hidden ?? false,
|
|
296
301
|
examples: cloneCommandExamples(config.examples),
|
|
297
302
|
aliases: [...(config.aliases ?? [])],
|
|
@@ -309,6 +314,8 @@ function createBaseCommand(config) {
|
|
|
309
314
|
};
|
|
310
315
|
Object.defineProperty(command, commandConfigSymbol, {
|
|
311
316
|
value: {
|
|
317
|
+
title: config.title,
|
|
318
|
+
annotations: cloneToolAnnotations(config.annotations),
|
|
312
319
|
scope: cloneScope(config.scope),
|
|
313
320
|
hidden: config.hidden ?? false,
|
|
314
321
|
examples: cloneCommandExamples(config.examples),
|
|
@@ -360,7 +367,9 @@ function materializeCommand(command, inherited) {
|
|
|
360
367
|
const materialized = {
|
|
361
368
|
kind: "command",
|
|
362
369
|
name: command.name,
|
|
370
|
+
title: internal.title,
|
|
363
371
|
description: command.description,
|
|
372
|
+
annotations: cloneToolAnnotations(internal.annotations),
|
|
364
373
|
hidden: internal.hidden,
|
|
365
374
|
examples: cloneCommandExamples(internal.examples),
|
|
366
375
|
aliases: [...command.aliases],
|
|
@@ -378,6 +387,8 @@ function materializeCommand(command, inherited) {
|
|
|
378
387
|
};
|
|
379
388
|
Object.defineProperty(materialized, commandConfigSymbol, {
|
|
380
389
|
value: {
|
|
390
|
+
title: internal.title,
|
|
391
|
+
annotations: cloneToolAnnotations(internal.annotations),
|
|
381
392
|
scope: cloneScope(internal.scope),
|
|
382
393
|
hidden: internal.hidden,
|
|
383
394
|
examples: cloneCommandExamples(internal.examples),
|
package/dist/mcp-proxy.js
CHANGED
|
@@ -78,7 +78,9 @@ function createProxyCommand(parent, tool, commandName, connection) {
|
|
|
78
78
|
return markProxyNode({
|
|
79
79
|
kind: "command",
|
|
80
80
|
name: commandName,
|
|
81
|
+
title: tool.title,
|
|
81
82
|
description: tool.description,
|
|
83
|
+
annotations: tool.annotations === undefined ? undefined : { ...tool.annotations },
|
|
82
84
|
hidden: false,
|
|
83
85
|
examples: [],
|
|
84
86
|
aliases: [],
|
package/dist/mcp.js
CHANGED
|
@@ -219,9 +219,11 @@ function enumerateTools(root, casing, allowlist, omitRootToolNamePrefix) {
|
|
|
219
219
|
}
|
|
220
220
|
commandPathsByToolName.set(name, resolvedCommandPath);
|
|
221
221
|
tools.push({
|
|
222
|
+
...(node.annotations === undefined ? {} : { annotations: { ...node.annotations } }),
|
|
222
223
|
command: node,
|
|
223
224
|
commandPath: resolvedCommandPath,
|
|
224
225
|
name,
|
|
226
|
+
...(node.title === undefined ? {} : { title: node.title }),
|
|
225
227
|
description: buildToolDescription(node.description, params, node.examples, node.name, casing),
|
|
226
228
|
inputSchema: applySchemaCasing(toJsonSchema(params), casing),
|
|
227
229
|
...(node.result === undefined
|
|
@@ -915,12 +917,18 @@ function createResolvedMCPServer(root, options, runtime = {}) {
|
|
|
915
917
|
throw toToolError(error, report?.displayPath);
|
|
916
918
|
}
|
|
917
919
|
};
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
920
|
+
server.registerTool({
|
|
921
|
+
name: tool.name,
|
|
922
|
+
...(tool.title === undefined ? {} : { title: tool.title }),
|
|
923
|
+
description: tool.description,
|
|
924
|
+
inputSchema: tool.inputSchema,
|
|
925
|
+
...(tool.outputSchema === undefined
|
|
926
|
+
? {}
|
|
927
|
+
: {
|
|
928
|
+
outputSchema: tool.outputSchema
|
|
929
|
+
}),
|
|
930
|
+
...(tool.annotations === undefined ? {} : { annotations: tool.annotations })
|
|
931
|
+
}, handler);
|
|
924
932
|
}
|
|
925
933
|
return {
|
|
926
934
|
...server,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.147",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"yaml"
|
|
159
159
|
],
|
|
160
160
|
"optionalDependencies": {
|
|
161
|
-
"toolcraft-schema": "0.0.
|
|
161
|
+
"toolcraft-schema": "0.0.147",
|
|
162
162
|
"toolcraft-design": "*",
|
|
163
163
|
"@poe-code/frontmatter": "*",
|
|
164
164
|
"@poe-code/agent-mcp-config": "*",
|