Skip to main content
Glama

getTaskSubtasks

Retrieve all subtasks for a specific Teamwork task, including pagination options and completed task filtering.

Instructions

Get all subtasks for a specific task in Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe ID of the task to get subtasks from
pageNoPage number for pagination
pageSizeNoNumber of items per page
includeCompletedTasksNoInclude completed tasks in the results

Implementation Reference

  • The handler function that implements the core logic of the 'getTaskSubtasks' tool. It extracts input parameters, builds query params, calls the Teamwork API to fetch subtasks for the given taskId, and returns the response or handles errors.
    export async function handleGetTaskSubtasks(input: any) { try { const { taskId, page, pageSize, includeCompletedTasks, ...otherParams } = input; logger.info(`Getting subtasks for task ID: ${taskId}`); // Build query parameters const queryParams: Record<string, any> = { page, pageSize, includeCompletedTasks, ...otherParams }; // Filter out undefined values Object.keys(queryParams).forEach(key => queryParams[key] === undefined && delete queryParams[key] ); // Make API call const apiClient = getApiClientForVersion(); const response = await apiClient.get( `/tasks/${taskId}/subtasks.json`, { params: queryParams } ); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] }; } catch (error: any) { return createErrorResponse(error, 'Retrieving task subtasks'); } }
  • The tool definition including name, description, input schema (with required taskId and optional pagination params), and annotations for the 'getTaskSubtasks' tool.
    export const getTaskSubtasksDefinition = { name: "getTaskSubtasks", description: "Get all subtasks for a specific task in Teamwork", inputSchema: { type: "object", properties: { taskId: { type: "integer", description: "The ID of the task to get subtasks from" }, page: { type: "integer", description: "Page number for pagination" }, pageSize: { type: "integer", description: "Number of items per page" }, includeCompletedTasks: { type: "boolean", description: "Include completed tasks in the results" } }, required: ["taskId"] }, annotations: { title: "Get Task Subtasks", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of the 'getTaskSubtasks' tool in the central toolPairs array, pairing its definition and handler for use in toolDefinitions and toolHandlersMap.
    { definition: getTasksMetricsLate, handler: handleGetTasksMetricsLate }, { definition: getTaskSubtasks, handler: handleGetTaskSubtasks },
  • Re-export of the handleGetTaskSubtasks handler from the index file for convenient access.
    export { handleGetTaskSubtasks } from './tasks/getTaskSubtasks.js';
  • Import of the getTaskSubtasks definition and handler into the central index file.
    import { getTaskSubtasksDefinition as getTaskSubtasks, handleGetTaskSubtasks } from './tasks/getTaskSubtasks.js';

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