fix(core): make fromJsonSchema() use runtime-aware default validator … (#1825)
Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
This commit is contained in:
parent
2fd7f5ff26
commit
5f32a90f0d
1 changed files with 74 additions and 6 deletions
|
|
@ -274,10 +274,10 @@ server.registerTool('greet', {
|
|||
inputSchema: type({ name: 'string' })
|
||||
}, async ({ name }) => { ... });
|
||||
|
||||
// Raw JSON Schema via fromJsonSchema
|
||||
import { fromJsonSchema, AjvJsonSchemaValidator } from '@modelcontextprotocol/server';
|
||||
// Raw JSON Schema via fromJsonSchema (validator defaults to runtime-appropriate choice)
|
||||
import { fromJsonSchema } from '@modelcontextprotocol/server';
|
||||
server.registerTool('greet', {
|
||||
inputSchema: fromJsonSchema({ type: 'object', properties: { name: { type: 'string' } } }, new AjvJsonSchemaValidator())
|
||||
inputSchema: fromJsonSchema({ type: 'object', properties: { name: { type: 'string' } } })
|
||||
}, handler);
|
||||
|
||||
// For tools with no parameters, use z.object({})
|
||||
|
|
|
|||
Loading…
Reference in a new issue