Loading
After scaffolding your server with agenticmarket create, you can add new tools with a single command. For the full end-to-end tutorial, see How to Create an MCP Server.
bashagenticmarket add tool get-weather
This command:
src/tools/get-weather.ts with a Zod-validated tool skeletonsrc/tools/index.tsYou do not need to edit index.ts manually.
Every generated tool follows this pattern:
typescriptimport { z } from "zod"; import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; export function registerGetWeatherTool(server: McpServer): void { server.tool( "get_weather", "Describe what this tool does for the AI agent.", { location: z.string().describe("City name or coordinates"), }, async ({ location }) => { // Your logic here return { content: [ { type: "text" as const, text: JSON.stringify({ location, temp: "22°C" }), }, ], }; }, ); }
Key points:
snake_case (get_weather, not getWeather)isError: true for error responses so the AI knows something failedIf you scaffolded with the API wrapper template, your generated tools use the built-in apiClient:
typescriptimport { apiClient } from "../lib/api-client.js"; const data = await apiClient.get("/users", { q: query });
The apiClient automatically:
.envAPI_TIMEOUT_MS)ApiClientError with status codes for clean error handlingYou can also create tool files manually. Just follow the pattern above and register them in src/tools/index.ts:
typescriptimport { registerGetWeatherTool } from "./get-weather.js"; export function registerAllTools(server: McpServer): void { registerGetWeatherTool(server); // add more tools here }
| Convention | Example |
|---|---|
| File name | get-weather.ts (kebab-case) |
| Tool name | get_weather (snake_case) |
| Function name | registerGetWeatherTool (PascalCase with prefix) |
| Description | Short, specific sentence for AI agents |