Add Tool to MCP Server
sf_create_mcp_toolAdds a new tool definition to an MCP server project by appending registration code to src/index.ts. Provide tool name, schema, and handler, then build.
Instructions
Adds a new tool definition to an existing MCP server project by reading the src/index.ts file and appending the tool registration. Provide the tool name, description, input schema as a JSON object (field names to {type, description}), and handler code. The tool code is inserted before the 'Start server' section. Run 'npm run build' after adding tools.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| toolName | Yes | Tool API name, e.g. 'get_account_data' | |
| handlerCode | Yes | TypeScript handler function body code | |
| inputSchema | Yes | JSON Schema for the tool's input parameters | |
| toolDescription | Yes | Detailed description of what the tool does | |
| projectDirectory | Yes | Absolute path to the MCP server project directory |