Skip to main content
Glama

getTaskSubtasks

Retrieve all subtasks for a specific task in Teamwork, including pagination options and the ability to include completed tasks.

Instructions

Get all subtasks for a specific task in Teamwork

Input Schema

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

Implementation Reference

  • The main handler function that implements the logic for the getTaskSubtasks tool. It extracts parameters, builds query params, calls the Teamwork API to fetch subtasks for the given taskId, and returns the response or error.
    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) { logger.error(`Error in getTaskSubtasks handler: ${error.message}`); return { content: [{ type: "text", text: `Error: ${error.message}` }] }; }
  • The tool definition object, including the input schema for validation, description, and annotations.
    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 toolPairs array, pairing its definition and handler for use in toolDefinitions and toolHandlersMap.
    { definition: getTaskSubtasks, handler: handleGetTaskSubtasks },
  • Import statement bringing in the definition and handler from the implementation file.
    import { getTaskSubtasksDefinition as getTaskSubtasks, handleGetTaskSubtasks } from './tasks/getTaskSubtasks.js';
  • Re-export of the handler function from the index for external use.
    export { 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