Skip to main content
Glama

getTaskById

Retrieve a specific task from Teamwork projects using its unique ID to access detailed information and manage project workflows.

Instructions

Get a specific task by ID from Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe ID of the task to retrieve

Implementation Reference

  • MCP tool handler function that validates input, calls the teamwork service to fetch the task, formats the response as text content, 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) {
        return createErrorResponse(error, 'Retrieving task');
      }
    } 
  • Tool definition including name, description, input schema (taskId as integer), and annotations for the MCP tool.
    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 toolPairs array, mapping definition to handler for MCP tool registry.
    { definition: getTaskById, handler: handleGetTaskById },
  • Service function that performs the actual API call to Teamwork to retrieve a task by ID, 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}`);
      }
    };
Behavior3/5

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

Annotations indicate readOnlyHint=false, openWorldHint=false, and destructiveHint=false, which the description doesn't contradict. The description adds minimal behavioral context beyond annotations—it implies a retrieval operation but doesn't detail error handling, authentication needs, or rate limits. With annotations covering safety, this is adequate but not rich.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's low complexity (single parameter, no output schema) and annotations covering safety, the description is minimally complete. However, it lacks details on return values, error cases, or integration with sibling tools, leaving gaps for an agent to infer usage in broader contexts.

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?

The input schema has 100% description coverage, with 'taskId' clearly documented as 'The ID of the task to retrieve'. The description doesn't add any extra meaning about parameters beyond what the schema provides, such as format examples or constraints, so it meets the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('Get') and resource ('a specific task by ID from Teamwork'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'getTasks' or 'getTaskSubtasks', which also retrieve tasks but with different scopes or filters.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'getTasks' (for listing tasks) or 'getTaskSubtasks' (for retrieving subtasks), nor does it specify prerequisites such as needing a valid task ID or context for when direct ID lookup is appropriate.

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