@frontmcp/skills 1.3.0 → 1.4.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 +38 -29
- package/catalog/TEMPLATE.md +26 -0
- package/catalog/create-tool/SKILL.md +318 -0
- package/catalog/create-tool/examples/01-basic-class-tool.md +112 -0
- package/catalog/create-tool/examples/02-basic-function-tool.md +80 -0
- package/catalog/create-tool/examples/03-tool-with-zod-shape-output.md +78 -0
- package/catalog/create-tool/examples/04-tool-with-zod-schema-output.md +97 -0
- package/catalog/create-tool/examples/05-tool-with-primitive-output.md +93 -0
- package/catalog/create-tool/examples/06-tool-with-media-output.md +109 -0
- package/catalog/create-tool/examples/08-tool-with-provider-injection.md +110 -0
- package/catalog/create-tool/examples/09-tool-with-multiple-providers.md +107 -0
- package/catalog/create-tool/examples/11-tool-with-fetch.md +94 -0
- package/catalog/create-tool/examples/12-tool-with-fetch-and-retries.md +115 -0
- package/catalog/create-tool/examples/13-tool-with-single-auth-provider.md +85 -0
- package/catalog/create-tool/examples/14-tool-with-multiple-auth-providers.md +105 -0
- package/catalog/create-tool/examples/15-tool-with-credential-vault.md +115 -0
- package/catalog/create-tool/examples/16-tool-with-rate-limit.md +71 -0
- package/catalog/create-tool/examples/17-tool-with-concurrency-and-timeout.md +101 -0
- package/catalog/create-tool/examples/18-tool-with-progress-and-notify.md +96 -0
- package/catalog/create-tool/examples/19-tool-with-elicitation.md +102 -0
- package/catalog/create-tool/examples/20-tool-with-annotations.md +125 -0
- package/catalog/create-tool/examples/21-tool-with-availability-constraints.md +107 -0
- package/catalog/create-tool/examples/22-tool-with-ui-html-template.md +93 -0
- package/catalog/create-tool/examples/23-tool-with-ui-filesource-tsx.md +112 -0
- package/catalog/create-tool/examples/24-tool-with-ui-csp-and-bridge.md +127 -0
- package/catalog/create-tool/examples/25-tool-handing-off-to-job.md +143 -0
- package/catalog/create-tool/examples/26-tool-with-resource-link-output.md +94 -0
- package/catalog/create-tool/examples/27-tool-with-examples-metadata.md +90 -0
- package/catalog/create-tool/references/annotations.md +96 -0
- package/catalog/create-tool/references/auth-providers.md +167 -0
- package/catalog/create-tool/references/availability.md +106 -0
- package/catalog/create-tool/references/decorator-options.md +95 -0
- package/catalog/create-tool/references/derived-types.md +102 -0
- package/catalog/create-tool/references/elicitation.md +128 -0
- package/catalog/create-tool/references/error-handling.md +128 -0
- package/catalog/create-tool/references/execution-context.md +158 -0
- package/catalog/create-tool/references/file-layout.md +96 -0
- package/catalog/create-tool/references/function-style-builder.md +118 -0
- package/catalog/create-tool/references/input-schema.md +141 -0
- package/catalog/create-tool/references/output-schema.md +175 -0
- package/catalog/create-tool/references/quick-start.md +124 -0
- package/catalog/create-tool/references/registration.md +132 -0
- package/catalog/create-tool/references/remote-and-esm.md +68 -0
- package/catalog/create-tool/references/testing.md +59 -0
- package/catalog/create-tool/references/throttling.md +109 -0
- package/catalog/create-tool/references/ui-widgets.md +198 -0
- package/catalog/create-tool/rules/always-define-output-schema.md +77 -0
- package/catalog/create-tool/rules/derive-execute-types.md +57 -0
- package/catalog/create-tool/rules/input-schema-is-raw-shape.md +76 -0
- package/catalog/create-tool/rules/no-toolcontext-generics.md +50 -0
- package/catalog/create-tool/rules/no-try-catch-around-execute.md +79 -0
- package/catalog/create-tool/rules/register-in-app.md +76 -0
- package/catalog/create-tool/rules/snake-case-tool-names.md +45 -0
- package/catalog/create-tool/rules/use-this-fail-for-business-errors.md +75 -0
- package/catalog/create-tool/rules/widget-paths-anchor-with-import-meta-url.md +76 -0
- package/catalog/create-tool/rules/widget-resource-mode-host-detect.md +61 -0
- package/catalog/frontmcp-auth-ui/SKILL.md +146 -0
- package/catalog/frontmcp-auth-ui/examples/custom-auth-ui/login-slot.md +97 -0
- package/catalog/frontmcp-auth-ui/examples/custom-auth-ui/multi-step-auth-extra.md +133 -0
- package/catalog/frontmcp-auth-ui/references/custom-auth-ui.md +162 -0
- package/catalog/frontmcp-authorities/SKILL.md +55 -18
- package/catalog/frontmcp-authorities/references/authority-profiles.md +25 -1
- package/catalog/frontmcp-authorities/references/custom-evaluators.md +1 -1
- package/catalog/frontmcp-authorities/references/rbac-abac-rebac.md +9 -0
- package/catalog/frontmcp-channels/SKILL.md +7 -1
- package/catalog/frontmcp-config/SKILL.md +9 -2
- package/catalog/frontmcp-config/examples/configure-auth/local-credential-vault.md +94 -0
- package/catalog/frontmcp-config/examples/configure-auth/local-secure-store.md +138 -0
- package/catalog/frontmcp-config/examples/configure-auth/remote-oauth-with-vault.md +45 -23
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-behind-tunnel.md +73 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-consent-enforcement.md +87 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-dcr-control.md +67 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-minimal.md +62 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-multi-provider-orchestration.md +93 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-self-signed-tokens.md +18 -20
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-single-operator.md +66 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/remote-enterprise-oauth.md +37 -23
- package/catalog/frontmcp-config/examples/configure-http/custom-http-routes.md +98 -0
- package/catalog/frontmcp-config/examples/configure-skills-http/audit-log-redis.md +17 -9
- package/catalog/frontmcp-config/references/configure-auth-modes.md +86 -23
- package/catalog/frontmcp-config/references/configure-auth.md +296 -50
- package/catalog/frontmcp-config/references/configure-http.md +149 -15
- package/catalog/frontmcp-deployment/SKILL.md +15 -13
- package/catalog/frontmcp-deployment/references/deploy-manifest-yaml.md +308 -0
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare-skills-only.md +174 -0
- package/catalog/frontmcp-deployment/references/mcp-client-integration.md +38 -2
- package/catalog/frontmcp-development/SKILL.md +30 -44
- package/catalog/frontmcp-development/references/decorators-guide.md +15 -15
- package/catalog/frontmcp-extensibility/SKILL.md +1 -1
- package/catalog/frontmcp-extensibility/examples/skill-audit-log/verify-chain.md +8 -6
- package/catalog/frontmcp-extensibility/references/skill-audit-log.md +7 -2
- package/catalog/frontmcp-guides/SKILL.md +1 -1
- package/catalog/frontmcp-observability/SKILL.md +1 -1
- package/catalog/frontmcp-production-readiness/SKILL.md +1 -1
- package/catalog/frontmcp-production-readiness/examples/common-checklist/security-hardening.md +3 -2
- package/catalog/frontmcp-setup/SKILL.md +1 -1
- package/catalog/frontmcp-setup/examples/multi-app-composition/per-app-auth-and-isolation.md +7 -4
- package/catalog/frontmcp-setup/references/multi-app-composition.md +6 -5
- package/catalog/frontmcp-testing/SKILL.md +9 -1
- package/catalog/frontmcp-testing/references/test-auth.md +24 -0
- package/catalog/skills-manifest.json +653 -149
- package/package.json +1 -1
- package/src/manifest.d.ts +72 -1
- package/src/manifest.js +4 -1
- package/src/manifest.js.map +1 -1
- package/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md +0 -80
- package/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md +0 -132
- package/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md +0 -110
- package/catalog/frontmcp-development/examples/create-tool-annotations/destructive-delete-tool.md +0 -92
- package/catalog/frontmcp-development/examples/create-tool-annotations/readonly-query-tool.md +0 -59
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/primitive-and-media-outputs.md +0 -101
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-raw-shape-output.md +0 -62
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-schema-advanced-output.md +0 -101
- package/catalog/frontmcp-development/references/create-tool-annotations.md +0 -48
- package/catalog/frontmcp-development/references/create-tool-output-schema-types.md +0 -71
- package/catalog/frontmcp-development/references/create-tool.md +0 -806
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: primitive-and-media-outputs
|
|
3
|
-
reference: create-tool-output-schema-types
|
|
4
|
-
level: intermediate
|
|
5
|
-
description: 'Demonstrates using primitive string literals and media types as `outputSchema` for tools that return plain text, images, or multi-content arrays.'
|
|
6
|
-
tags: [development, output-schema, tool, output, schema, types]
|
|
7
|
-
features:
|
|
8
|
-
- "Using `'string'` literal to return plain text output"
|
|
9
|
-
- "Using `'image'` literal to return base64 image data"
|
|
10
|
-
- "Using `['string', 'image']` array to return multi-content (text plus image) in a single response"
|
|
11
|
-
- "Other available primitives: `'number'`, `'boolean'`, `'date'`"
|
|
12
|
-
- "Other available media types: `'audio'`, `'resource'`, `'resource_link'`"
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
# Primitive Literal and Media Type Output Schemas
|
|
16
|
-
|
|
17
|
-
Demonstrates using primitive string literals and media types as `outputSchema` for tools that return plain text, images, or multi-content arrays.
|
|
18
|
-
|
|
19
|
-
## Code
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
// src/tools/summarize.tool.ts
|
|
23
|
-
import { Tool, ToolContext, z } from '@frontmcp/sdk';
|
|
24
|
-
|
|
25
|
-
// Primitive literal: returns plain text
|
|
26
|
-
@Tool({
|
|
27
|
-
name: 'summarize_text',
|
|
28
|
-
description: 'Summarize a long text into a short paragraph',
|
|
29
|
-
inputSchema: {
|
|
30
|
-
text: z.string().describe('The text to summarize'),
|
|
31
|
-
},
|
|
32
|
-
outputSchema: 'string',
|
|
33
|
-
})
|
|
34
|
-
class SummarizeTextTool extends ToolContext {
|
|
35
|
-
async execute(input: { text: string }) {
|
|
36
|
-
const summary = await this.get(LlmService).summarize(input.text);
|
|
37
|
-
return summary;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
// src/tools/generate-chart.tool.ts
|
|
44
|
-
import { Tool, ToolContext, z } from '@frontmcp/sdk';
|
|
45
|
-
|
|
46
|
-
// Media type: returns base64 image data
|
|
47
|
-
@Tool({
|
|
48
|
-
name: 'generate_chart',
|
|
49
|
-
description: 'Generate a chart image from data points',
|
|
50
|
-
inputSchema: {
|
|
51
|
-
data: z.array(z.object({ label: z.string(), value: z.number() })),
|
|
52
|
-
chartType: z.enum(['bar', 'line', 'pie']),
|
|
53
|
-
},
|
|
54
|
-
outputSchema: 'image',
|
|
55
|
-
})
|
|
56
|
-
class GenerateChartTool extends ToolContext {
|
|
57
|
-
async execute(input: { data: Array<{ label: string; value: number }>; chartType: string }) {
|
|
58
|
-
const chartService = this.get(ChartService);
|
|
59
|
-
const imageBase64 = await chartService.render(input.data, input.chartType);
|
|
60
|
-
return imageBase64;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
// src/tools/analyze-document.tool.ts
|
|
67
|
-
import { Tool, ToolContext, z } from '@frontmcp/sdk';
|
|
68
|
-
|
|
69
|
-
// Multi-content array: returns text + image
|
|
70
|
-
@Tool({
|
|
71
|
-
name: 'analyze_document',
|
|
72
|
-
description: 'Analyze a document and return summary with visual highlights',
|
|
73
|
-
inputSchema: {
|
|
74
|
-
documentId: z.string().describe('Document ID to analyze'),
|
|
75
|
-
},
|
|
76
|
-
outputSchema: ['string', 'image'],
|
|
77
|
-
})
|
|
78
|
-
class AnalyzeDocumentTool extends ToolContext {
|
|
79
|
-
async execute(input: { documentId: string }) {
|
|
80
|
-
const doc = this.get(DocumentService);
|
|
81
|
-
const analysis = await doc.analyze(input.documentId);
|
|
82
|
-
return {
|
|
83
|
-
text: analysis.summary,
|
|
84
|
-
image: analysis.highlightImageBase64,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## What This Demonstrates
|
|
91
|
-
|
|
92
|
-
- Using `'string'` literal to return plain text output
|
|
93
|
-
- Using `'image'` literal to return base64 image data
|
|
94
|
-
- Using `['string', 'image']` array to return multi-content (text plus image) in a single response
|
|
95
|
-
- Other available primitives: `'number'`, `'boolean'`, `'date'`
|
|
96
|
-
- Other available media types: `'audio'`, `'resource'`, `'resource_link'`
|
|
97
|
-
|
|
98
|
-
## Related
|
|
99
|
-
|
|
100
|
-
- See `create-tool-output-schema-types` for the complete list of supported output schema types
|
|
101
|
-
- See `decorators-guide` for the full `@Tool` decorator field reference
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: zod-raw-shape-output
|
|
3
|
-
reference: create-tool-output-schema-types
|
|
4
|
-
level: basic
|
|
5
|
-
description: 'Demonstrates the recommended approach of using a Zod raw shape as `outputSchema` for structured, validated JSON output.'
|
|
6
|
-
tags: [development, codecall, output-schema, tool, output, schema]
|
|
7
|
-
features:
|
|
8
|
-
- 'Using a Zod raw shape (plain object with Zod types) as `outputSchema` for structured output'
|
|
9
|
-
- 'The output is validated at runtime against the schema before being returned to the client'
|
|
10
|
-
- 'This is the recommended pattern for CodeCall compatibility and data leak prevention'
|
|
11
|
-
- 'The `execute()` return type is automatically inferred from the output schema'
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Zod Raw Shape Output Schema
|
|
15
|
-
|
|
16
|
-
Demonstrates the recommended approach of using a Zod raw shape as `outputSchema` for structured, validated JSON output.
|
|
17
|
-
|
|
18
|
-
## Code
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
// src/tools/get-user-profile.tool.ts
|
|
22
|
-
import { Tool, ToolContext, z } from '@frontmcp/sdk';
|
|
23
|
-
|
|
24
|
-
@Tool({
|
|
25
|
-
name: 'get_user_profile',
|
|
26
|
-
description: 'Retrieve a user profile by ID',
|
|
27
|
-
inputSchema: {
|
|
28
|
-
userId: z.string().describe('The user ID to look up'),
|
|
29
|
-
},
|
|
30
|
-
outputSchema: {
|
|
31
|
-
name: z.string(),
|
|
32
|
-
email: z.string().email(),
|
|
33
|
-
age: z.number(),
|
|
34
|
-
roles: z.array(z.string()),
|
|
35
|
-
active: z.boolean(),
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
class GetUserProfileTool extends ToolContext {
|
|
39
|
-
async execute(input: { userId: string }) {
|
|
40
|
-
const db = this.get(DatabaseToken);
|
|
41
|
-
const user = await db.findUser(input.userId);
|
|
42
|
-
return {
|
|
43
|
-
name: user.name,
|
|
44
|
-
email: user.email,
|
|
45
|
-
age: user.age,
|
|
46
|
-
roles: user.roles,
|
|
47
|
-
active: user.active,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## What This Demonstrates
|
|
54
|
-
|
|
55
|
-
- Using a Zod raw shape (plain object with Zod types) as `outputSchema` for structured output
|
|
56
|
-
- The output is validated at runtime against the schema before being returned to the client
|
|
57
|
-
- This is the recommended pattern for CodeCall compatibility and data leak prevention
|
|
58
|
-
- The `execute()` return type is automatically inferred from the output schema
|
|
59
|
-
|
|
60
|
-
## Related
|
|
61
|
-
|
|
62
|
-
- See `create-tool-output-schema-types` for all supported output schema formats
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: zod-schema-advanced-output
|
|
3
|
-
reference: create-tool-output-schema-types
|
|
4
|
-
level: advanced
|
|
5
|
-
description: 'Demonstrates using full Zod schema objects (not raw shapes) as `outputSchema`, including `z.object()`, `z.array()`, `z.union()`, and `z.discriminatedUnion()`.'
|
|
6
|
-
tags: [development, output-schema, tool, output, schema, types]
|
|
7
|
-
features:
|
|
8
|
-
- 'Using `z.object()` for structured output with nested arrays and nullable fields'
|
|
9
|
-
- 'Using `z.discriminatedUnion()` to return different output shapes based on a discriminant field'
|
|
10
|
-
- 'Full Zod schemas provide the same validation as raw shapes but support more complex types'
|
|
11
|
-
- 'Output is validated at runtime -- mismatched return values trigger validation errors'
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Advanced Zod Schema Output Types
|
|
15
|
-
|
|
16
|
-
Demonstrates using full Zod schema objects (not raw shapes) as `outputSchema`, including `z.object()`, `z.array()`, `z.union()`, and `z.discriminatedUnion()`.
|
|
17
|
-
|
|
18
|
-
## Code
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
// src/tools/list-products.tool.ts
|
|
22
|
-
import { Tool, ToolContext, z } from '@frontmcp/sdk';
|
|
23
|
-
|
|
24
|
-
// z.object() -- structured object output
|
|
25
|
-
@Tool({
|
|
26
|
-
name: 'get_order_status',
|
|
27
|
-
description: 'Get the current status of an order',
|
|
28
|
-
inputSchema: {
|
|
29
|
-
orderId: z.string(),
|
|
30
|
-
},
|
|
31
|
-
outputSchema: z.object({
|
|
32
|
-
orderId: z.string(),
|
|
33
|
-
status: z.enum(['pending', 'processing', 'shipped', 'delivered']),
|
|
34
|
-
estimatedDelivery: z.string().nullable(),
|
|
35
|
-
items: z.array(
|
|
36
|
-
z.object({
|
|
37
|
-
name: z.string(),
|
|
38
|
-
quantity: z.number(),
|
|
39
|
-
}),
|
|
40
|
-
),
|
|
41
|
-
}),
|
|
42
|
-
})
|
|
43
|
-
class GetOrderStatusTool extends ToolContext {
|
|
44
|
-
async execute(input: { orderId: string }) {
|
|
45
|
-
const order = await this.get(OrderService).getStatus(input.orderId);
|
|
46
|
-
return {
|
|
47
|
-
orderId: order.id,
|
|
48
|
-
status: order.status,
|
|
49
|
-
estimatedDelivery: order.estimatedDelivery,
|
|
50
|
-
items: order.items.map((i) => ({ name: i.name, quantity: i.quantity })),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
// src/tools/search-catalog.tool.ts
|
|
58
|
-
import { Tool, ToolContext, z } from '@frontmcp/sdk';
|
|
59
|
-
|
|
60
|
-
// z.discriminatedUnion() -- different shapes based on a type field
|
|
61
|
-
const ProductResult = z.discriminatedUnion('type', [
|
|
62
|
-
z.object({
|
|
63
|
-
type: z.literal('physical'),
|
|
64
|
-
name: z.string(),
|
|
65
|
-
weight: z.number(),
|
|
66
|
-
dimensions: z.object({ width: z.number(), height: z.number(), depth: z.number() }),
|
|
67
|
-
}),
|
|
68
|
-
z.object({
|
|
69
|
-
type: z.literal('digital'),
|
|
70
|
-
name: z.string(),
|
|
71
|
-
downloadUrl: z.string(),
|
|
72
|
-
fileSizeMb: z.number(),
|
|
73
|
-
}),
|
|
74
|
-
]);
|
|
75
|
-
|
|
76
|
-
@Tool({
|
|
77
|
-
name: 'get_product',
|
|
78
|
-
description: 'Retrieve product details by ID',
|
|
79
|
-
inputSchema: {
|
|
80
|
-
productId: z.string(),
|
|
81
|
-
},
|
|
82
|
-
outputSchema: ProductResult,
|
|
83
|
-
})
|
|
84
|
-
class GetProductTool extends ToolContext {
|
|
85
|
-
async execute(input: { productId: string }) {
|
|
86
|
-
const product = await this.get(CatalogService).findById(input.productId);
|
|
87
|
-
return product;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## What This Demonstrates
|
|
93
|
-
|
|
94
|
-
- Using `z.object()` for structured output with nested arrays and nullable fields
|
|
95
|
-
- Using `z.discriminatedUnion()` to return different output shapes based on a discriminant field
|
|
96
|
-
- Full Zod schemas provide the same validation as raw shapes but support more complex types
|
|
97
|
-
- Output is validated at runtime -- mismatched return values trigger validation errors
|
|
98
|
-
|
|
99
|
-
## Related
|
|
100
|
-
|
|
101
|
-
- See `create-tool-output-schema-types` for all supported output schema formats including primitives and media types
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-tool-annotations
|
|
3
|
-
description: Reference for MCP tool annotation hints like readOnly, destructive, and idempotent
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Tool Annotations Reference
|
|
7
|
-
|
|
8
|
-
Annotations provide hints to MCP clients about tool behavior:
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
@Tool({
|
|
12
|
-
name: 'my_tool',
|
|
13
|
-
inputSchema: { ... },
|
|
14
|
-
annotations: {
|
|
15
|
-
title: 'My Tool', // Human-readable display name
|
|
16
|
-
readOnlyHint: true, // Tool only reads data, no side effects
|
|
17
|
-
destructiveHint: false, // Tool does NOT destroy/delete data
|
|
18
|
-
idempotentHint: true, // Safe to call multiple times with same input
|
|
19
|
-
openWorldHint: false, // Tool does NOT interact with external world
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Fields
|
|
25
|
-
|
|
26
|
-
| Field | Type | Default | Description |
|
|
27
|
-
| ----------------- | --------- | ------- | ---------------------------------- |
|
|
28
|
-
| `title` | `string` | — | Human-friendly display name |
|
|
29
|
-
| `readOnlyHint` | `boolean` | `false` | Tool only reads, no mutations |
|
|
30
|
-
| `destructiveHint` | `boolean` | `true` | Tool may delete/overwrite data |
|
|
31
|
-
| `idempotentHint` | `boolean` | `false` | Repeated calls produce same result |
|
|
32
|
-
| `openWorldHint` | `boolean` | `true` | Tool may access external services |
|
|
33
|
-
|
|
34
|
-
## Usage Guidance
|
|
35
|
-
|
|
36
|
-
- Set `readOnlyHint: true` for query/lookup tools
|
|
37
|
-
- Set `destructiveHint: true` for delete/overwrite operations (triggers client warnings)
|
|
38
|
-
- Set `idempotentHint: true` for safe-to-retry tools
|
|
39
|
-
- Set `openWorldHint: false` for tools that only access local data
|
|
40
|
-
|
|
41
|
-
## Examples
|
|
42
|
-
|
|
43
|
-
| Example | Level | Description |
|
|
44
|
-
| ------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
-
| [`destructive-delete-tool`](../examples/create-tool-annotations/destructive-delete-tool.md) | Intermediate | Demonstrates annotating a tool that deletes data, enabling MCP clients to warn users before execution. |
|
|
46
|
-
| [`readonly-query-tool`](../examples/create-tool-annotations/readonly-query-tool.md) | Basic | Demonstrates annotating a tool that only reads data, signaling to MCP clients that it has no side effects and is safe to retry. |
|
|
47
|
-
|
|
48
|
-
> See all examples in [`examples/create-tool-annotations/`](../examples/create-tool-annotations/)
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-tool-output-schema-types
|
|
3
|
-
description: Reference for all supported outputSchema types including Zod shapes and JSON Schema
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Output Schema Types Reference
|
|
7
|
-
|
|
8
|
-
All supported `outputSchema` types for `@Tool`:
|
|
9
|
-
|
|
10
|
-
## Zod Raw Shapes (Recommended)
|
|
11
|
-
|
|
12
|
-
```typescript
|
|
13
|
-
outputSchema: {
|
|
14
|
-
name: z.string(),
|
|
15
|
-
count: z.number(),
|
|
16
|
-
items: z.array(z.string()),
|
|
17
|
-
}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Produces structured JSON output. **Best practice for CodeCall compatibility and data leak prevention.**
|
|
21
|
-
|
|
22
|
-
## Zod Schemas
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
outputSchema: z.object({ result: z.number() })
|
|
26
|
-
outputSchema: z.array(z.string())
|
|
27
|
-
outputSchema: z.union([z.string(), z.number()])
|
|
28
|
-
outputSchema: z.discriminatedUnion('type', [...])
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Primitive Literals
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
outputSchema: 'string'; // Returns plain text
|
|
35
|
-
outputSchema: 'number'; // Returns a number
|
|
36
|
-
outputSchema: 'boolean'; // Returns true/false
|
|
37
|
-
outputSchema: 'date'; // Returns an ISO date string
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Media Types
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
outputSchema: 'image'; // Returns base64 image data
|
|
44
|
-
outputSchema: 'audio'; // Returns base64 audio data
|
|
45
|
-
outputSchema: 'resource'; // Returns a resource content
|
|
46
|
-
outputSchema: 'resource_link'; // Returns a resource URI link
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Multi-Content Arrays
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
outputSchema: ['string', 'image']; // Returns text + image content
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## No OutputSchema (Not Recommended)
|
|
56
|
-
|
|
57
|
-
When `outputSchema` is omitted, the tool returns unvalidated content. This:
|
|
58
|
-
|
|
59
|
-
- Risks leaking internal fields to the client
|
|
60
|
-
- Prevents CodeCall from inferring return types
|
|
61
|
-
- Loses compile-time type checking on `Out` generic
|
|
62
|
-
|
|
63
|
-
## Examples
|
|
64
|
-
|
|
65
|
-
| Example | Level | Description |
|
|
66
|
-
| ----------------------------------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
67
|
-
| [`primitive-and-media-outputs`](../examples/create-tool-output-schema-types/primitive-and-media-outputs.md) | Intermediate | Demonstrates using primitive string literals and media types as `outputSchema` for tools that return plain text, images, or multi-content arrays. |
|
|
68
|
-
| [`zod-raw-shape-output`](../examples/create-tool-output-schema-types/zod-raw-shape-output.md) | Basic | Demonstrates the recommended approach of using a Zod raw shape as `outputSchema` for structured, validated JSON output. |
|
|
69
|
-
| [`zod-schema-advanced-output`](../examples/create-tool-output-schema-types/zod-schema-advanced-output.md) | Advanced | Demonstrates using full Zod schema objects (not raw shapes) as `outputSchema`, including `z.object()`, `z.array()`, `z.union()`, and `z.discriminatedUnion()`. |
|
|
70
|
-
|
|
71
|
-
> See all examples in [`examples/create-tool-output-schema-types/`](../examples/create-tool-output-schema-types/)
|