Skip to main content
Glama

get_task

Fetch a specific task by dart_id, with optional comments and relationship details. Use flags to include or expand relationships for controlled output size.

Instructions

Get a specific task by dart_id with optional comments and relationship details. Returns task relationships (subtasks, blockers, blocking, duplicates, related) with counts and optional expanded titles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dart_idYesTask dart_id
include_commentsNoInclude task comments in response (default: false)
include_relationshipsNoInclude relationship fields and counts in response (default: true). Set to false for smaller response.
expand_relationshipsNoFetch titles for all related tasks (default: false). Requires additional API calls. Only applies when include_relationships is true.

Implementation Reference

  • Main handler function for the get_task tool. Validates input, calls DartClient.getTask(), generates deep link URL, optionally fetches comments, relationship counts, and expanded relationships, then returns GetTaskOutput.
    export async function handleGetTask(input: GetTaskInput): Promise<GetTaskOutput> {
      const DART_TOKEN = process.env.DART_TOKEN;
    
      if (!DART_TOKEN) {
        throw new DartAPIError(
          'DART_TOKEN environment variable is required. Get your token from: https://app.dartai.com/?settings=account',
          401
        );
      }
    
      // ============================================================================
      // Step 1: Validate input and dart_id
      // ============================================================================
      if (!input || typeof input !== 'object') {
        throw new DartAPIError(
          'input is required and must be an object',
          400
        );
      }
    
      // Accept id, task_id, or taskId as aliases for dart_id
      input.dart_id = resolveDartId(input as unknown as Record<string, unknown>);
    
      // Default include_relationships to true
      const includeRelationships = input.include_relationships !== false;
      const expandRelationships = input.expand_relationships === true;
    
      // ============================================================================
      // Step 2: Call DartClient.getTask()
      // ============================================================================
      const client = new DartClient({ token: DART_TOKEN });
    
      let task: DartTask;
      try {
        task = await client.getTask(input.dart_id);
      } catch (error) {
        // Handle 404 errors specifically
        if (error instanceof DartAPIError && error.statusCode === 404) {
          throw new DartAPIError(
            `Task not found: No task with dart_id "${input.dart_id}" exists in workspace`,
            404,
            error.response
          );
        }
        // Re-throw other errors with enhanced context
        if (error instanceof DartAPIError) {
          throw new DartAPIError(
            `Failed to retrieve task: ${error.message}`,
            error.statusCode,
            error.response
          );
        }
        throw error;
      }
    
      // ============================================================================
      // Step 3: Generate deep link URL
      // ============================================================================
      const deepLinkUrl = `https://app.dartai.com/task/${task.dart_id}`;
    
      // ============================================================================
      // Step 4: Optionally fetch comments
      // ============================================================================
      let comments: DartComment[] | undefined;
    
      if (input.include_comments) {
        // TODO: Implement comment fetching when API endpoint is available
        // For now, return empty array as placeholder
        comments = [];
    
        // Note: Once Dart API exposes /tasks/{dart_id}/comments endpoint:
        // try {
        //   comments = await client.getTaskComments(task.dart_id);
        // } catch (error) {
        //   // Log error but don't fail the entire request if comment fetch fails
        //   console.error(`Failed to fetch comments for task ${task.dart_id}:`, error);
        //   comments = [];
        // }
      }
    
      // ============================================================================
      // Step 5: Build output with relationship information
      // ============================================================================
      const output: GetTaskOutput = {
        // If include_relationships is false, strip the relationship fields from task
        task: includeRelationships ? task : stripRelationshipFields(task),
        url: deepLinkUrl,
      };
    
      // Only include comments field if include_comments was requested
      if (input.include_comments) {
        output.comments = comments;
      }
    
      // ============================================================================
      // Step 6: Add relationship counts and expanded relationships
      // ============================================================================
      if (includeRelationships) {
        // Always include relationship counts when relationships are included
        output.relationship_counts = calculateRelationshipCounts(task);
    
        // Optionally fetch expanded relationships (titles for related tasks)
        if (expandRelationships) {
          output.expanded_relationships = await fetchExpandedRelationships(client, task);
        }
      }
    
      return output;
    }
  • Input schema for get_task: dart_id (required), include_comments, include_relationships (default true), expand_relationships.
    export interface GetTaskInput {
      dart_id: string;
      include_comments?: boolean;
      /**
       * Include relationship fields in response (default: true).
       * When false, relationship arrays are omitted for smaller response.
       */
      include_relationships?: boolean;
      /**
       * Expand related task summaries (fetch titles for each related task).
       * Requires additional API calls. Only applies when include_relationships is true.
       */
      expand_relationships?: boolean;
    }
  • Output schema for get_task: task (DartTask), optional comments, url, relationship_counts, and expanded_relationships.
    export interface GetTaskOutput {
      task: DartTask;
      comments?: DartComment[];
      url: string;
      /**
       * Relationship counts for quick overview (when include_relationships is true)
       */
      relationship_counts?: RelationshipCounts;
      /**
       * Expanded relationship details with titles (when expand_relationships is true)
       */
      expanded_relationships?: ExpandedRelationships;
    }
  • src/index.ts:343-368 (registration)
    Tool registration in the MCP server definition: name 'get_task', description, inputSchema with dart_id, include_comments, include_relationships, expand_relationships.
    {
      name: 'get_task',
      description: 'Get a specific task by dart_id with optional comments and relationship details. Returns task relationships (subtasks, blockers, blocking, duplicates, related) with counts and optional expanded titles.',
      inputSchema: {
        type: 'object',
        properties: {
          dart_id: {
            type: 'string',
            description: 'Task dart_id',
          },
          include_comments: {
            type: 'boolean',
            description: 'Include task comments in response (default: false)',
          },
          include_relationships: {
            type: 'boolean',
            description: 'Include relationship fields and counts in response (default: true). Set to false for smaller response.',
          },
          expand_relationships: {
            type: 'boolean',
            description: 'Fetch titles for all related tasks (default: false). Requires additional API calls. Only applies when include_relationships is true.',
          },
        },
        required: ['dart_id'],
      },
    },
  • src/index.ts:1016-1025 (registration)
    Tool call handler for 'get_task' case: calls handleGetTask and returns JSON-stringified result.
    case 'get_task': {
      const result = await handleGetTask((args || {}) as any);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
Behavior3/5

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

Without annotations, the description adds behavioral context by mentioning optional comments, relationship details, and the note about expand_relationships requiring additional API calls. However, it does not disclose whether the operation is read-only, error handling for missing IDs, or any side effects.

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 two sentences long, front-loaded with the primary action, and every word serves a purpose. No filler or redundancy.

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?

No output schema exists, so the description must cover return values. It mentions 'task relationships with counts and optional expanded titles,' which partially covers the response, but it omits error conditions, response format, and what the base task object includes.

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 coverage is 100%, so baseline is 3. The description paraphrases the boolean parameters (optional comments, relationship details, expanded titles) but does not add new meaning beyond what the schema already 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 'Get a specific task by dart_id' with optional comments and relationship details, which distinguishes it from sibling tools like list_tasks or search_tasks that retrieve multiple tasks.

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

Usage Guidelines3/5

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

The description implies use when you have a specific dart_id, but it does not explicitly state when to use this tool versus alternatives like list_tasks or search_tasks, nor does it mention when-not-to-use or prerequisites.

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/standardbeagle/dart-query'

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