Skip to main content
Glama

getTaskSubtasks

Retrieve all subtasks for a given task in Teamwork, with pagination support and optional inclusion of completed tasks.

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 main handler function that executes the 'getTaskSubtasks' tool logic. It accepts an input object containing taskId (required), page, pageSize, and includeCompletedTasks, makes a GET request to /tasks/{taskId}/subtasks.json via the Teamwork API client, and returns the subtasks data.
    // Tool handler
    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/input schema for 'getTaskSubtasks'. It specifies the tool name, description, and input schema properties: taskId (required integer), page (integer), pageSize (integer), and includeCompletedTasks (boolean). Also includes annotations for the tool.
    // Tool definition
    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
      }
    };
  • The import of the getTaskSubtasks definition and handler from the getTaskSubtasks module into the tools index.
    import { getTaskSubtasksDefinition as getTaskSubtasks, handleGetTaskSubtasks } from './tasks/getTaskSubtasks.js';
  • Registration of the getTaskSubtasks tool pair (definition + handler) in the toolPairs array within the tools index.
    { definition: getTaskSubtasks, handler: handleGetTaskSubtasks },
  • Configuration file where 'getTaskSubtasks' is listed as one of the available tools under the 'Tasks' group.
    const toolGroups: Record<string, string[]> = {
      'Projects': ['getProjects', 'getCurrentProject', 'createProject'],
      'Tasks': ['getTasks', 'getTasksByProjectId', 'getTaskListsByProjectId', 'getTaskById', 'createTask', 'createSubTask', 'updateTask', 'deleteTask', 'getTasksMetricsComplete', 'getTasksMetricsLate', 'getTaskSubtasks', 'getTaskComments'],
      'People': ['getPeople', 'getPersonById', 'getProjectPeople', 'addPeopleToProject', 'deletePerson', 'getProjectsPeopleMetricsPerformance', 'getProjectsPeopleUtilization', 'getProjectPerson'],
      'Reporting': ['getProjectsReportingUserTaskCompletion', 'getProjectsReportingUtilization'],
      'Time': ['getTime', 'getProjectsAllocationsTime', 'getTimezones'],
      'Comments': ['createComment'],
      'Companies': ['createCompany', 'updateCompany', 'deleteCompany', 'getCompanies', 'getCompanyById']
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations provide readOnlyHint=false (implying it's not read-only, though the operation is inherently read) and destructiveHint=false. The description adds no behavioral details (e.g., pagination behavior, error cases, output format).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-formed sentence that is front-loaded with the core purpose. No extraneous words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has pagination and filtering parameters and no output schema, the description provides no information about the return format, pagination defaults, or whether subtasks include nested ones. Incomplete for a moderate-complexity tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters. The description adds no additional meaning beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'subtasks for a specific task', and it distinguishes from siblings like getTasks (which returns top-level tasks) and createSubTask.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives such as getTasks (which might include subtasks) or createSubTask. No prerequisites or exclusions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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