@@ -6,14 +6,14 @@ type { RequestHandlerExtra } from @modelcontextprotocol/sdk/shared/protocol.js
66{ IS_DEV } from ./const.civet
77
88// Translates the input/output schema to a basic object type
9- // Apparently Zod didn't have this feature
9+ // Apparently Zod didn't have this feature (maybe it's skill issue...?)
1010// Maybe I should just use the `zod-to-json-schema` package? Not sure...
11- export TInferedSchema<T> ::= [K in keyof T]: T[K] < ZodType ? z.infer<T[K]> : never
11+ export TInferedSchema<T> ::= [K in keyof T]: if T[K] < ZodType then z.infer<T[K]> else never
1212export TSerializable<T> ::= [K in keyof T]: Primitive | TSerializable<T[K]> | TSerializable<T[K]>[]
1313
1414export ToolDeclarationConfig ::= {
15- inputSchema: ZodRawShape < infer TInputSchema ? TInputSchema : never
16- outputSchema?: ZodRawShape < infer TOutputSchema ? TOutputSchema : never
15+ inputSchema: if ZodRawShape < infer TInputSchema then TInputSchema else never
16+ outputSchema?: if ZodRawShape < infer TOutputSchema then TOutputSchema else never
1717 annotations?: ToolAnnotations
1818 title: string
1919 description: string
@@ -22,7 +22,7 @@ export ToolDeclarationConfig ::= {
2222export ToolDeclarationRunCallback<TConfig < ToolDeclarationConfig = ToolDeclarationConfig, TConstructor < new (...args: any[]) => any = new () => any> ::=
2323 (
2424 @: ToolDeclaration<TConfig, TConstructor> & InstanceType<TConstructor>,
25- args: TInferedSchema<TConfig["inputSchema"] < infer TInputSchema ? TInputSchema : never>,
25+ args: TInferedSchema<if TConfig["inputSchema"] < infer TInputSchema then TInputSchema else never>,
2626 extra: RequestHandlerExtra<ServerRequest, ServerNotification>
2727 ) -> Promise<
2828 TSerializable<TInferedSchema<TConfig["outputSchema"]>> | TSerializable<TInferedSchema<TConfig["outputSchema"]>>[] | null
@@ -44,7 +44,7 @@ export class ToolDeclaration<TConfig < ToolDeclarationConfig = ToolDeclarationCo
4444
4545 @(args: ToolDeclarationArgs<TConfig, TConstructor>) {
4646 @config = args.config
47- @run = args.run.bind( @ as any)
47+ @run = args.run.bind @ as InstanceType<TConstructor>
4848 @name = args.name
4949 }
5050}
@@ -105,8 +105,7 @@ export registerTools := <TConfig < ToolDeclarationConfig, T < ToolDeclaration<TC
105105 member.name,
106106 member.config,
107107 // Wrap the run call in a try/catch and return the result in the MCP format
108- // @ts-expect-error -- The types are all right here, but the SDK won't know that a `Promise` of the
109- // `ToolCallback` is a valid `ToolCallback` (because promises are flattened)
108+ // @ts-expect-error FIXME
110109 safeActionCallToOutput member
111110 )
112111 }
0 commit comments