File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed
Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change 2626 "@tsconfig/bun" : " 1.0.7" ,
2727 "ai" : " 4.2.11" ,
2828 "hono" : " 4.11.4" ,
29- "zod" : " 4.2.1" ,
30- "zod-to-json-schema" : " 3.25.0"
29+ "zod" : " 4.2.1"
3130 },
3231 "devDependencies" : {
33- "@standard-schema/spec" : " 1.0 .0" ,
32+ "@standard-schema/spec" : " 1.1 .0" ,
3433 "opencontrol-frontend" : " workspace:*"
3534 }
3635}
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import {
1010} from "@modelcontextprotocol/sdk/types.js"
1111import { z } from "zod"
1212import { Tool } from "./tool.js"
13- import { zodToJsonSchema } from "zod-to-json-schema"
1413
1514const RequestSchema = z . union ( [
1615 InitializeRequestSchema ,
@@ -41,10 +40,11 @@ export function createMcp(input: { tools: Tool[] }) {
4140 return {
4241 tools : input . tools . map ( ( tool ) => ( {
4342 name : tool . name ,
44- inputSchema : zodToJsonSchema (
45- tool . args || ( z . object ( { } ) as any ) ,
46- "args" ,
47- ) . definitions ! [ "args" ] as any ,
43+ inputSchema : ( tool . args
44+ ? tool . args [ "~standard" ] . jsonSchema . input ( {
45+ target : "draft-2020-12" ,
46+ } )
47+ : { type : "object" } ) as { type : "object" } ,
4848 description : tool . description ,
4949 } ) ) ,
5050 } satisfies ListToolsResult
Original file line number Diff line number Diff line change 1- import { StandardSchemaV1 } from "@standard-schema/spec"
1+ import { StandardJSONSchemaV1 , StandardSchemaV1 } from "@standard-schema/spec"
22import { z } from "zod"
33
4- export interface Tool <
5- Args extends undefined | StandardSchemaV1 = undefined | StandardSchemaV1 ,
6- > {
4+ type Schema = StandardSchemaV1 & StandardJSONSchemaV1
5+
6+ export interface Tool < Args extends undefined | Schema = undefined | Schema > {
77 name : string
88 description : string
99 args ?: Args
10- run : Args extends StandardSchemaV1
10+ run : Args extends Schema
1111 ? ( args : StandardSchemaV1 . InferOutput < Args > ) => Promise < any >
1212 : ( ) => Promise < any >
1313}
1414
15- export function tool < Args extends undefined | StandardSchemaV1 > (
16- input : Tool < Args > ,
17- ) {
15+ export function tool < Args extends undefined | Schema > ( input : Tool < Args > ) {
1816 return input
1917}
2018
You can’t perform that action at this time.
0 commit comments