Skip to main content
Glama

list_comments

Retrieve paginated comments for a task. Returns minimal comment data to reduce token usage.

Instructions

List comments on a task with pagination. Token-efficient: returns minimal comment data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesTask dart_id to list comments for
limitNoMax comments to return (default: 50, max: 100)
offsetNoPagination offset (default: 0)

Implementation Reference

  • Main handler function for the list_comments tool. Validates inputs (task_id, limit, offset), calls the DartClient.listComments API, maps results to DartComment type, and returns paginated output.
    export async function handleListComments(input: ListCommentsInput): Promise<ListCommentsOutput> {
      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
        );
      }
    
      // Validate input
      if (!input || typeof input !== 'object') {
        throw new ValidationError('Input must be an object', 'input');
      }
    
      if (!input.task_id || typeof input.task_id !== 'string' || input.task_id.trim() === '') {
        throw new ValidationError('task_id is required and must be a non-empty string', 'task_id');
      }
    
      // Validate pagination params
      const limit = input.limit ?? 50;
      if (typeof limit !== 'number' || limit < 1 || limit > 100) {
        throw new ValidationError('limit must be a number between 1 and 100', 'limit');
      }
    
      const offset = input.offset ?? 0;
      if (typeof offset !== 'number' || offset < 0) {
        throw new ValidationError('offset must be a non-negative number', 'offset');
      }
    
      const client = new DartClient({ token: DART_TOKEN });
    
      const result = await client.listComments({
        task_id: input.task_id.trim(),
        limit,
        offset,
      });
    
      const returnedCount = result.comments.length;
      const hasMore = (offset + returnedCount) < result.total;
    
      // Map to DartComment type
      const comments: DartComment[] = result.comments.map(c => ({
        comment_id: c.comment_id,
        text: c.text,
        author: c.author,
        created_at: c.created_at,
        parent_id: c.parent_id,
      }));
    
      return {
        comments,
        total_count: result.total,
        returned_count: returnedCount,
        has_more: hasMore,
        next_offset: hasMore ? offset + returnedCount : null,
        task_id: input.task_id.trim(),
      };
    }
  • DartComment interface - the comment data structure returned by the tool.
    export interface DartComment {
      comment_id: string;
      dart_id?: string; // task id (optional in list responses)
      text: string;
      author: string;
      created_at?: string;
      parent_id?: string; // For threaded comments
    }
  • ListCommentsInput and ListCommentsOutput type definitions with task_id, limit, offset, pagination metadata.
    export interface ListCommentsInput {
      task_id: string;
      limit?: number;
      offset?: number;
    }
    
    export interface ListCommentsOutput {
      comments: DartComment[];
      total_count: number;
      returned_count: number;
      has_more: boolean;
      next_offset: number | null;
      task_id: string;
    }
  • src/index.ts:823-844 (registration)
    Tool registration entry defining name 'list_comments', description, and JSON Schema input schema (task_id required, limit/offset optional).
    {
      name: 'list_comments',
      description: 'List comments on a task with pagination. Token-efficient: returns minimal comment data.',
      inputSchema: {
        type: 'object',
        properties: {
          task_id: {
            type: 'string',
            description: 'Task dart_id to list comments for',
          },
          limit: {
            type: 'integer',
            description: 'Max comments to return (default: 50, max: 100)',
          },
          offset: {
            type: 'integer',
            description: 'Pagination offset (default: 0)',
          },
        },
        required: ['task_id'],
      },
    },
  • src/index.ts:1196-1206 (registration)
    Router case dispatching 'list_comments' tool calls to handleListComments handler.
    case 'list_comments': {
      const result = await handleListComments((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?

With no annotations, the description carries full burden. It discloses token efficiency and returns minimal data, but omits behavioral details such as errors, permissions, rate limits, or behavior for invalid task IDs.

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?

Two sentences, front-loaded with purpose and key feature. No wasted words.

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?

For a 3-param tool with no output schema or annotations, the description covers core functionality and pagination, but lacks details on response format, error handling, or limits on task_id. Adequate but not thorough.

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?

Input schema has 100% coverage with descriptions for all parameters. The description adds 'Token-efficient' which hints at response brevity but does not enhance parameter meaning beyond schema. Baseline 3 is appropriate.

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 tool's action ('List comments on a task'), includes pagination, and emphasizes token efficiency. It effectively distinguishes from sibling tools like add_task_comment (which adds comments) and search_tasks (which searches tasks).

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 lacks explicit guidance on when to use this tool versus alternatives. It does not mention prerequisites, exclusions, or scenarios where other tools might be preferred, leaving the agent to infer usage from context.

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