@@ -6,7 +6,7 @@ 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, so I wrote this basic implementation
9+ // Apparently Zod didn't have this feature
1010// Maybe I should just use the `zod-to-json-schema` package? Not sure...
1111export TInferedSchema<T> ::= [K in keyof T]: T[K] < ZodType ? z.infer<T[K]> : never
1212export TSerializable<T> ::= [K in keyof T]: Primitive | TSerializable<T[K]> | TSerializable<T[K]>[]
@@ -59,7 +59,7 @@ sendNotificationFromExtra := (extra: RequestHandlerExtra<ServerRequest, ServerNo
5959 }
6060 }
6161
62- safeActionCallToOutput := <T extends ZodRawShape, TMember < ToolDeclaration>(member: TMember) ->
62+ safeActionCallToOutput := <T < ZodRawShape, TMember < ToolDeclaration>(member: TMember) ->
6363 (args: TInferedSchema<T>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) ->
6464 sendNotification := sendNotificationFromExtra extra
6565 content: []
@@ -85,8 +85,12 @@ safeActionCallToOutput := <T extends ZodRawShape, TMember < ToolDeclaration>(mem
8585 )
8686 |> JSON.stringify
8787
88- // All tools are loaded via a glob scan, so we can just iterate over the files and import them
89- // This means to create new tools you just need to create a new file in `src/tools`
88+ /**
89+ * Registers all tools with the server
90+ * @param tools - The tools to register
91+ * @param server - The server to register the tools with
92+ * @returns The server with the tools registered
93+ */
9094export registerTools := <TConfig < ToolDeclarationConfig, T < ToolDeclaration<TConfig>>(tools: Record<string, T>) -> (server: McpServer) -> {
9195 // Register tools based on the glob pattern
9296 for await member of Object.values tools {
0 commit comments