Skip to main content
Glama
xiaolai
by xiaolai

find_todos

Extract TODO, FIXME, and DRAFT markers from manuscript files to track writing tasks and identify areas needing attention in your project.

Instructions

Extract all TODO/FIXME/DRAFT markers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathNoPath to manuscript directory (defaults to current directory)
scopeNoFile scope pattern
markersNoMarkers to search for
group_byNoGrouping method
limitNoMaximum results

Implementation Reference

  • The primary MCP tool handler for 'find_todos'. Extracts parameters from args (scope, markers, groupBy, limit with pagination), then calls WritersAid.findTodos.
    private async findTodos(args: Record<string, unknown>) {
      const scope = args.scope as string | undefined;
      const markers = args.markers as string[] | undefined;
      const groupBy = args.group_by as "file" | "priority" | "marker" | undefined;
      const limit = resolvePaginationLimit("find_todos", args.limit as number | undefined);
    
      return this.writersAid.findTodos({ scope, markers, groupBy, limit });
    }
  • JSON schema defining the input parameters and structure for the 'find_todos' tool.
    name: "find_todos",
    description: "Extract all TODO/FIXME/DRAFT markers",
    inputSchema: {
      type: "object",
      properties: {
        project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" },
        scope: { type: "string", description: "File scope pattern" },
        markers: {
          type: "array",
          items: { type: "string" },
          description: "Markers to search for",
        },
        group_by: {
          type: "string",
          enum: ["file", "priority", "marker"],
          description: "Grouping method",
        },
        limit: { type: "number", description: "Maximum results", default: 50 },
      },
    },
  • Dispatch registration in the central handleTool switch statement that maps tool name 'find_todos' to its handler method.
    case "find_todos":
      return this.findTodos(args);
  • Core helper function that implements TODO extraction logic: scans all file lines with regex for markers, extracts text and line numbers, assigns priority, and applies pagination.
    async findTodos(options: {
      scope?: string;
      markers?: string[];
      groupBy?: "file" | "priority" | "marker";
      limit?: number;
    }): Promise<TodoItem[]> {
      const { markers = ["TODO", "FIXME", "HACK", "XXX", "DRAFT", "WIP"], limit } = options;
    
      const files = await this.storage.getAllFiles();
      const todos: TodoItem[] = [];
    
      for (const file of files) {
        const lines = file.content.split("\n");
    
        for (let i = 0; i < lines.length; i++) {
          const line = lines[i];
    
          for (const marker of markers) {
            const regex = new RegExp(`\\b${marker}\\b:?\\s*(.*)`, "i");
            const match = line.match(regex);
    
            if (match) {
              todos.push({
                file: file.file_path,
                line: i + 1,
                marker,
                text: match[1] || "",
                priority: this.determinePriority(marker),
              });
            }
          }
        }
      }
    
      return paginateResults(todos, limit);
    }

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/xiaolai/claude-writers-aid-mcp'

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