Skip to main content
Glama

getTaskById

Retrieve a specific task by its unique ID using Teamwork MCP server. Input the task ID to access detailed task information directly from the Teamwork API.

Instructions

Get a specific task by ID from Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe ID of the task to retrieve

Implementation Reference

  • The handler function that implements the core logic of the getTaskById tool. It processes input, calls the teamwork service to fetch the task, formats the response, and handles errors.
    export async function handleGetTaskById(input: any) { logger.info('Calling teamworkService.getTaskById()'); logger.info(`Task ID: ${input?.taskId}`); try { const taskId = String(input?.taskId); if (!taskId) { throw new Error("Task ID is required"); } const task = await teamworkService.getTaskById(taskId); return { content: [{ type: "text", text: JSON.stringify(task, null, 2) }] }; } catch (error: any) { logger.error(`Error in getTaskById handler: ${error.message}`); return { content: [{ type: "text", text: `Error retrieving task: ${error.message}` }] }; } }
  • The tool definition including name, description, input schema (requiring taskId as integer), and annotations.
    export const getTaskByIdDefinition = { name: "getTaskById", description: "Get a specific task by ID from Teamwork", inputSchema: { type: "object", properties: { taskId: { type: "integer", description: "The ID of the task to retrieve" } }, required: ["taskId"] }, annotations: { title: "Get a Task by its ID", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of the getTaskById tool in the central toolPairs array, pairing its definition and handler for use in toolDefinitions and toolHandlersMap.
    { definition: getTaskById, handler: handleGetTaskById },
  • Supporting service function that performs the actual API call to retrieve the task by ID from Teamwork, used by the tool handler.
    export const getTaskById = async (taskId: string) => { try { const api = ensureApiClient(); const response = await api.get(`/tasks/${taskId}.json`); return response.data; } catch (error: any) { logger.error(`Error fetching task ${taskId}: ${error.message}`); throw new Error(`Failed to fetch task ${taskId}`); } };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vizioz/Teamwork-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server