Skip to main content
Glama

epic_list

Read-onlyIdempotent

List epics for any project. Filter by status, priority, or git branch—auto-detect active branch or show only branch-agnostic epics. Includes task counts and completion statistics.

Instructions

List epics for a project with task counts and completion stats. Optionally filter by status, priority, or branch. Pass branch="current" to auto-detect the active git branch; pass empty string to list only branch-agnostic epics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID
statusNo
priorityNo
branchNoFilter by git branch. Pass "current" to auto-detect; pass empty string to list only branch-agnostic epics. Omit to list all.

Implementation Reference

  • The main handler function for the 'epic_list' tool. Builds a dynamic SQL query with LEFT JOIN on tasks to compute task_count, done_count, blocked_count, and completion_pct, filtering by project_id, status, priority, and branch (with support for 'current' auto-detection via resolveBranch).
    function handleEpicList(args: Record<string, unknown>) {
      const db = getDb();
      const projectId = args.project_id as number;
      const status = args.status as string | undefined;
      const priority = args.priority as string | undefined;
      const branchFilter = resolveBranch(args.branch);
    
      const whereClauses = ['e.project_id = ?'];
      const params: unknown[] = [projectId];
    
      if (status) {
        whereClauses.push('e.status = ?');
        params.push(status);
      }
      if (priority) {
        whereClauses.push('e.priority = ?');
        params.push(priority);
      }
      if (branchFilter === null) {
        whereClauses.push('e.branch IS NULL');
      } else if (branchFilter !== undefined) {
        whereClauses.push('e.branch = ?');
        params.push(branchFilter);
      }
    
      const sql = `
        SELECT e.*,
          COUNT(t.id) as task_count,
          SUM(CASE WHEN t.status = 'done' THEN 1 ELSE 0 END) as done_count,
          SUM(CASE WHEN t.status = 'blocked' THEN 1 ELSE 0 END) as blocked_count,
          CASE WHEN COUNT(t.id) > 0
            THEN ROUND(SUM(CASE WHEN t.status = 'done' THEN 1 ELSE 0 END) * 100.0 / COUNT(t.id), 1)
            ELSE 0 END as completion_pct
        FROM epics e
        LEFT JOIN tasks t ON t.epic_id = e.id
        WHERE ${whereClauses.join(' AND ')}
        GROUP BY e.id
        ORDER BY e.sort_order, e.created_at
      `;
    
      return db.prepare(sql).all(...params);
    }
  • Schema definition for epic_list: registers the tool with name 'epic_list', provides description, and defines inputSchema requiring project_id with optional filters for status, priority, and branch.
    {
      name: 'epic_list',
      description:
        'List epics for a project with task counts and completion stats. Optionally filter by status, priority, or branch. Pass branch="current" to auto-detect the active git branch; pass empty string to list only branch-agnostic epics.',
      annotations: { title: 'List Epics', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
      inputSchema: {
        type: 'object',
        properties: {
          project_id: { type: 'integer', description: 'Project ID' },
          status: { type: 'string', enum: ['planned', 'in_progress', 'completed', 'cancelled'] },
          priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
          branch: {
            type: 'string',
            description: 'Filter by git branch. Pass "current" to auto-detect; pass empty string to list only branch-agnostic epics. Omit to list all.',
          },
        },
        required: ['project_id'],
      },
    },
  • Registration of epic_list handler in the handlers export map, mapping the string 'epic_list' to the handleEpicList function.
    export const handlers: Record<string, ToolHandler> = {
      epic_create: handleEpicCreate,
      epic_list: handleEpicList,
      epic_update: handleEpicUpdate,
    };
  • The resolveBranch helper used by handleEpicList to resolve the 'branch' argument. Returns null for empty string (branch-agnostic), undefined if omitted, the current git branch for 'current', or the literal string value.
    export function resolveBranch(input: unknown): string | null | undefined {
      if (input === undefined) return undefined;
      if (input === null || input === '') return null;
      if (typeof input !== 'string') return undefined;
      if (input === 'current') return getCurrentBranch();
      return input;
    }
Behavior4/5

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

Annotations already declare readOnlyHint, destructiveHint, and idempotentHint, so no side effects are expected. The description adds value by revealing return details (task counts, completion stats) and filtering behavior, consistent with the annotations.

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, front-loaded with the primary purpose, and includes essential filter details without redundancy. Every sentence is informative.

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

Completeness4/5

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

Given the absence of an output schema, the description adequately mentions return content (task counts and completion stats). Combined with annotations, it covers safety and idempotency. Filtering guidance is sufficient, though no mention of pagination or ordering.

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?

With 50% schema description coverage, the description compensates partially by elaborating on the branch parameter (e.g., auto-detect, empty string behavior). It does not add extra meaning for status, priority, or project_id, but the enums are self-explanatory. 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 lists epics with task counts and completion stats, and specifies optional filters. It distinguishes itself from sibling tools like epic_create or task_list by focusing on listing with statistics.

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

Usage Guidelines4/5

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

The description explains when to use this tool (to list epics) and provides specific guidance for the branch parameter (e.g., 'current' for auto-detection). However, it lacks explicit when-not-to-use instructions or alternatives among siblings.

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/spranab/saga-mcp'

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