Mapping API Path, Query, Header, and Body Parameters to MCP Tool Schemas A developer explains how to map HTTP API path, query, header, and body parameters to MCP tool schemas, using a project-management API as an example. The tutorial demonstrates converting a PATCH endpoint into a single structured input schema, emphasizing clear tool naming and explicit path identifiers. An API operation can receive input from several places. Path parameters identify the record. Query parameters filter or paginate the result. Headers carry metadata or authentication. The request body contains structured data for create and update operations. An MCP tool should give the AI client one clear input schema. That is the mapping problem: HTTP API inputs path + query + headers + body become MCP tool input one structured schema the AI client can understand This tutorial walks through that mapping with practical examples. The goal is to make the tool easy for an AI client to call without hiding the real API contract. Imagine a project-management API with this endpoint: PATCH /workspaces/{workspace id}/projects/{project id}/tasks/{task id} It updates one task. The API accepts: workspace id , project id , and task id ; notify assignee ; Idempotency-Key .A shortened OpenAPI-style version might look like this: paths: /workspaces/{workspace id}/projects/{project id}/tasks/{task id}: patch: operationId: updateTask summary: Update a task description: "Update the title, status, assignee, or due date for one task." parameters: - name: workspace id in: path required: true schema: type: string - name: project id in: path required: true schema: type: string - name: task id in: path required: true schema: type: string - name: notify assignee in: query required: false schema: type: boolean default: false - name: Idempotency-Key in: header required: false schema: type: string requestBody: required: true content: application/json: schema: type: object properties: title: "" type: string status: type: string enum: todo, in progress, blocked, done assignee id: type: string due date: type: string format: date minProperties: 1 security: - bearerAuth: The API shape is split across the HTTP request. The MCP tool should present the editable parts in one schema. The route is useful for the adapter, but it is not a good tool name. This is weak: { "name": "patch workspaces projects tasks" } This is clearer: { "name": "update task" } If your API has several update operations, use the object and action to remove ambiguity: update task update task status assign task reschedule task The right name depends on what the endpoint actually does. If the endpoint updates many fields, update task may be correct. If the endpoint only changes status, update task status is better. Path parameters usually identify the exact resource being addressed. In an MCP tool schema, they are usually required fields. From the route: /workspaces/{workspace id}/projects/{project id}/tasks/{task id} The tool needs: { "workspace id": "wrk 123", "project id": "prj 456", "task id": "tsk 789" } In the MCP tool schema: { "type": "object", "properties": { "workspace id": { "type": "string", "description": "The workspace that contains the project." }, "project id": { "type": "string", "description": "The project that contains the task." }, "task id": { "type": "string", "description": "The task to update." } }, "required": "workspace id", "project id", "task id" } Keep the path identifiers explicit. Do not collapse them into one generic id field if the API needs all three values. The AI client should not guess which ID belongs to which level. Query parameters often change how the operation behaves: In the example, notify assignee controls whether the API sends a notification after the update. That should appear as an optional tool input: { "notify assignee": { "type": "boolean", "description": "Whether to notify the assigned user after the task is updated.", "default": false } } For list operations, query parameters may be the main tool inputs: GET /customers/{customer id}/tickets?status=open&limit=20&cursor=abc The MCP schema might expose: { "type": "object", "properties": { "customer id": { "type": "string", "description": "The customer whose tickets should be listed." }, "status": { "type": "string", "enum": "open", "pending", "closed" , "description": "Optional ticket status filter." }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20, "description": "Maximum number of tickets to return." }, "cursor": { "type": "string", "description": "Pagination cursor from a previous response." } }, "required": "customer id" } Good query mapping keeps list tools bounded. If a search endpoint accepts unlimited free-form parameters, the agent may produce slow, broad, or invalid calls. Headers are tricky because some are normal inputs and some are credentials. Authentication headers should not become normal tool inputs. Do not expose this: { "authorization": { "type": "string", "description": "Bearer token for the API request." } } That would make the credential model-visible. Instead, the tool input should stay focused on the business operation: { "workspace id": "wrk 123", "project id": "prj 456", "task id": "tsk 789", "status": "blocked" } The adapter or hosted MCP runtime should receive credentials through the authentication path and forward them to the upstream API: Authorization: Bearer