get_total_worklogs
Calculate total logged time for a specific project by providing its unique identifier through the Plane MCP Server, aiding in tracking project progress.
Instructions
Get total logged time for a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The uuid identifier of the project to get total worklogs for |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"project_id": {
"description": "The uuid identifier of the project to get total worklogs for",
"type": "string"
}
},
"required": [
"project_id"
],
"type": "object"
}
Implementation Reference
- src/tools/work-log.ts:37-50 (handler)The handler function that executes the tool: makes a GET request to the Plane API for total worklogs of a project and returns the JSON response as text content.async ({ project_id }) => { const response = await makePlaneRequest( "GET", `workspaces/${process.env.PLANE_WORKSPACE_SLUG}/projects/${project_id}/total-worklogs/` ); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; }
- src/tools/work-log.ts:34-36 (schema)Zod input schema defining the project_id parameter for the tool.{ project_id: z.string().describe("The uuid identifier of the project to get total worklogs for"), },
- src/tools/work-log.ts:31-51 (registration)Registration of the get_total_worklogs tool using server.tool(), including description, schema, and inline handler.server.tool( "get_total_worklogs", "Get total logged time for a project", { project_id: z.string().describe("The uuid identifier of the project to get total worklogs for"), }, async ({ project_id }) => { const response = await makePlaneRequest( "GET", `workspaces/${process.env.PLANE_WORKSPACE_SLUG}/projects/${project_id}/total-worklogs/` ); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } );
- src/tools/index.ts:24-24 (registration)Higher-level registration call to registerWorkLogTools(server), which registers the get_total_worklogs tool among others.registerWorkLogTools(server);
- src/common/request-helper.ts:3-36 (helper)Supporting utility function makePlaneRequest used by the handler to perform authenticated HTTP requests to the Plane API.export async function makePlaneRequest<T>(method: string, path: string, body: any = null): Promise<T> { const hostUrl = process.env.PLANE_API_HOST_URL || "https://api.plane.so/"; const host = hostUrl.endsWith("/") ? hostUrl : `${hostUrl}/`; const url = `${host}api/v1/${path}`; const headers: Record<string, string> = { "X-API-Key": process.env.PLANE_API_KEY || "", }; // Only add Content-Type for non-GET requests if (method.toUpperCase() !== "GET") { headers["Content-Type"] = "application/json"; } try { const config: AxiosRequestConfig = { url, method, headers, }; // Only include body for non-GET requests if (method.toUpperCase() !== "GET" && body !== null) { config.data = body; } const response = await axios(config); return response.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Request failed: ${error.message}`); } throw error; } }