* Helper function to create a tool definition with automatic handler creation
(
name: string,
schema: TSchema,
toolFn: (
client: DocumentEngineClient,
params: ZodInfer<ZodObject<TSchema>>
) => Promise<MCPToolOutput>
)
| 132 | * Helper function to create a tool definition with automatic handler creation |
| 133 | */ |
| 134 | function createTool<TSchema extends ZodRawShape>( |
| 135 | name: string, |
| 136 | schema: TSchema, |
| 137 | toolFn: ( |
| 138 | client: DocumentEngineClient, |
| 139 | params: ZodInfer<ZodObject<TSchema>> |
| 140 | ) => Promise<MCPToolOutput> |
| 141 | ): MCPTool { |
| 142 | return { |
| 143 | name, |
| 144 | schema, |
| 145 | handler: createToolHandler(toolFn)(name), |
| 146 | }; |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * Creates and returns the array of tools to register with the MCP server |
no test coverage detected