call
Execute ZenTao RESTful API calls to manage projects, track bugs, and handle product data with automatic token authentication.
Instructions
Call any ZenTao RESTful API endpoint (api.php/v1). Automatically injects Token header. Paths accept leading slash or relative.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Relative path, e.g. /projects or projects/1 | |
| method | No | HTTP verb | GET |
| query | No | Query params object | |
| body | No | JSON body | |
| forceTokenRefresh | No | Refresh token before request |
Implementation Reference
- src/zentao-mcp-server.js:557-575 (handler)Specific handler logic for the 'call' tool within the MCP CallToolRequestSchema handler. Extracts arguments and delegates to callZenTao helper.if (name === "call") { const { path, method = "GET", query, body, forceTokenRefresh = false } = args; if (!path) throw new Error("path is required"); const response = await callZenTao({ path, method, query, body, forceTokenRefresh, }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; }
- src/zentao-mcp-server.js:79-111 (helper)Core implementation of the API call to ZenTao, handling authentication token, URL building, HTTP request, and response parsing.async function callZenTao({ path, method = "GET", query, body, headers = {}, forceTokenRefresh = false, }) { assertConfig(); const token = await fetchToken(forceTokenRefresh); const url = buildUrl(path, query); const res = await fetch(url, { method, headers: { "Content-Type": "application/json", Token: token, ...headers, }, body: body ? JSON.stringify(body) : undefined, }); const text = await res.text(); const data = safeJson(text); if (!res.ok) { throw new Error( `Request failed ${res.status}: ${text || res.statusText || "unknown"}` ); } return { status: res.status, headers: Object.fromEntries(res.headers.entries()), data: data ?? text, }; }
- src/zentao-mcp-server.js:389-413 (registration)Tool registration in the tools/list response, defining name, description, and input schema for the 'call' tool.{ name: "call", description: "Call any ZenTao RESTful API endpoint (api.php/v1). Automatically injects Token header. Paths accept leading slash or relative.", inputSchema: { type: "object", properties: { path: { type: "string", description: "Relative path, e.g. /projects or projects/1" }, method: { type: "string", description: "HTTP verb", enum: ["GET", "POST", "PUT", "PATCH", "DELETE"], default: "GET", }, query: { type: "object", description: "Query params object", additionalProperties: true }, body: { type: "object", description: "JSON body", additionalProperties: true }, forceTokenRefresh: { type: "boolean", description: "Refresh token before request", }, }, required: ["path"], additionalProperties: false, }, },
- src/zentao-mcp-server.js:393-412 (schema)Input schema definition for the 'call' tool, specifying parameters like path, method, query, body.inputSchema: { type: "object", properties: { path: { type: "string", description: "Relative path, e.g. /projects or projects/1" }, method: { type: "string", description: "HTTP verb", enum: ["GET", "POST", "PUT", "PATCH", "DELETE"], default: "GET", }, query: { type: "object", description: "Query params object", additionalProperties: true }, body: { type: "object", description: "JSON body", additionalProperties: true }, forceTokenRefresh: { type: "boolean", description: "Refresh token before request", }, }, required: ["path"], additionalProperties: false, },