Skip to content

Commit d27eae3

Browse files
committed
docs(js/plugins/anthropic): align MCP schema comments with Anthropic docs
Update MCP schemas to use Zod .describe() for consistency with codebase: - name: clarify must be referenced by exactly one MCPToolset - authorization_token: specify OAuth token - mcp_server_name: clarify must match server in mcp_servers array - defer_loading: explain tool description behavior - default_config/configs: clarify override precedence
1 parent 66127b8 commit d27eae3

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

js/plugins/anthropic/src/types.ts

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,16 @@ export interface ClaudeRunnerParams extends ClaudeHelperParamsBase {}
6969
*/
7070
export const McpToolConfigSchema = z
7171
.object({
72-
/** Whether this tool is enabled */
73-
enabled: z.boolean().optional(),
74-
/** Whether to defer loading this tool */
75-
defer_loading: z.boolean().optional(),
72+
enabled: z
73+
.boolean()
74+
.optional()
75+
.describe('Whether this tool is enabled. Defaults to true.'),
76+
defer_loading: z
77+
.boolean()
78+
.optional()
79+
.describe(
80+
'If true, tool description is not sent to the model initially. Used with Tool Search Tool.'
81+
),
7682
})
7783
.passthrough();
7884

@@ -81,19 +87,26 @@ export const McpToolConfigSchema = z
8187
*/
8288
export const McpServerConfigSchema = z
8389
.object({
84-
/** Type must be 'url' for remote MCP servers */
85-
type: z.literal('url'),
86-
/** The URL of the MCP server (must be https) */
90+
type: z
91+
.literal('url')
92+
.describe('Type of MCP server connection. Currently only "url" is supported.'),
8793
url: z
8894
.string()
8995
.url('MCP server URL must be a valid URL')
9096
.refine((url) => url.startsWith('https://'), {
9197
message: 'MCP server URL must use HTTPS protocol',
92-
}),
93-
/** A unique name for this MCP server */
94-
name: z.string().min(1, 'MCP server name cannot be empty'),
95-
/** Optional authorization token for the MCP server */
96-
authorization_token: z.string().optional(),
98+
})
99+
.describe('The URL of the MCP server. Must start with https://.'),
100+
name: z
101+
.string()
102+
.min(1, 'MCP server name cannot be empty')
103+
.describe(
104+
'A unique identifier for this MCP server. Must be referenced by exactly one MCPToolset.'
105+
),
106+
authorization_token: z
107+
.string()
108+
.optional()
109+
.describe('OAuth authorization token if required by the MCP server.'),
97110
})
98111
.passthrough();
99112

@@ -102,14 +115,19 @@ export const McpServerConfigSchema = z
102115
*/
103116
export const McpToolsetSchema = z
104117
.object({
105-
/** Type must be 'mcp_toolset' */
106-
type: z.literal('mcp_toolset'),
107-
/** The name of the MCP server this toolset references */
108-
mcp_server_name: z.string(),
109-
/** Default configuration applied to all tools in this toolset */
110-
default_config: McpToolConfigSchema.optional(),
111-
/** Per-tool configuration overrides */
112-
configs: z.record(z.string(), McpToolConfigSchema).optional(),
118+
type: z.literal('mcp_toolset').describe('Type must be "mcp_toolset".'),
119+
mcp_server_name: z
120+
.string()
121+
.describe('Must match a server name defined in the mcp_servers array.'),
122+
default_config: McpToolConfigSchema.optional().describe(
123+
'Default configuration applied to all tools. Individual tool configs will override these defaults.'
124+
),
125+
configs: z
126+
.record(z.string(), McpToolConfigSchema)
127+
.optional()
128+
.describe(
129+
'Per-tool configuration overrides. Keys are tool names, values are configuration objects.'
130+
),
113131
})
114132
.passthrough();
115133

0 commit comments

Comments
 (0)