MCPcopy Create free account
hub / github.com/PSPDFKit/nutrient-document-engine-mcp-server / createTool

Function createTool

src/mcpTools.ts:134–147  ·  view source on GitHub ↗

* Helper function to create a tool definition with automatic handler creation

(
  name: string,
  schema: TSchema,
  toolFn: (
    client: DocumentEngineClient,
    params: ZodInfer<ZodObject<TSchema>>
  ) => Promise<MCPToolOutput>
)

Source from the content-addressed store, hash-verified

132 * Helper function to create a tool definition with automatic handler creation
133 */
134function 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

Callers 1

mcpTools.tsFile · 0.85

Calls 1

createToolHandlerFunction · 0.85

Tested by

no test coverage detected