Add Tool to MCP Server
sf_create_mcp_toolAdd a new tool definition to an existing MCP server project by modifying src/index.ts. Provide tool name, description, JSON schema, and handler code; the registration is inserted before server start, then run npm run 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 |