Skip to main content
Glama

search_plans

Search Claude Code plan files to find past implementation approaches, decisions, and patterns for current development challenges.

Instructions

Search Claude Code plan files for past implementation approaches, decisions, and patterns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for plan content
limitNoMaximum number of results (default: 10)
detail_levelNoResponse detail levelsummary

Implementation Reference

  • Core handler implementation in HistorySearchEngine that finds Claude plan files (.md), reads and parses them for titles, sections, and file references, computes relevance score based on query matching in title/sections/content, sorts by relevance, and returns top results.
    async searchPlans(query: string, limit: number = 10): Promise<PlanResult[]> {
      try {
        const planFiles = await findPlanFiles();
        const plansPath = getClaudePlansPath();
    
        // Process all plan files in parallel
        const planResults = await Promise.allSettled(
          planFiles.map(async (filename) => {
            const filepath = join(plansPath, filename);
            const content = await readFile(filepath, 'utf-8');
            const stats = await stat(filepath);
    
            // Parse markdown structure
            const title = this.extractPlanTitle(content);
            const sections = this.extractPlanSections(content);
            const filesMentioned = this.extractFileReferences(content);
    
            // Calculate relevance score
            const relevanceScore = this.calculatePlanRelevance(query, title, sections, content);
    
            return {
              name: filename.replace('.md', ''),
              filepath,
              title,
              content: content.substring(0, 2000), // Limit content size
              sections,
              filesMentioned,
              timestamp: stats.mtime.toISOString(),
              relevanceScore,
            };
          })
        );
    
        // Collect successful results
        const plans: PlanResult[] = [];
        for (const result of planResults) {
          if (result.status === 'fulfilled') {
            plans.push(result.value);
          }
        }
    
        // Filter by relevance and sort
        return plans
          .filter((p) => p.relevanceScore > 0)
          .sort((a, b) => b.relevanceScore - a.relevanceScore)
          .slice(0, limit);
      } catch (error) {
        console.error('Plan search error:', error);
        return [];
      }
    }
  • src/index.ts:230-255 (registration)
    Tool registration in MCP ListTools handler, defining name, description, and input schema (query required, optional limit and detail_level).
    {
      name: 'search_plans',
      description:
        'Search Claude Code plan files for past implementation approaches, decisions, and patterns',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query for plan content',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results (default: 10)',
            default: 10,
          },
          detail_level: {
            type: 'string',
            description: 'Response detail level',
            enum: ['summary', 'detailed', 'raw'],
            default: 'summary',
          },
        },
        required: ['query'],
      },
    },
  • MCP CallToolRequestSchema handler case for search_plans: extracts args, calls UniversalHistorySearchEngine.searchPlans (which delegates to HistorySearchEngine), formats output with BeautifulFormatter.formatPlanSearch, returns formatted text content.
    case 'search_plans': {
      const query = args?.query as string;
      const limit = (args?.limit as number) || 10;
      const detailLevel = (args?.detail_level as string) || 'summary';
    
      const result = await this.universalEngine.searchPlans(query, limit);
      const formattedResult = this.formatter.formatPlanSearch(
        { searchQuery: query, plans: result.results },
        detailLevel
      );
    
      return {
        content: [{ type: 'text', text: formattedResult }],
      };
    }
  • Delegation handler in UniversalHistorySearchEngine.searchPlans that forwards to HistorySearchEngine.searchPlans (claudeCodeEngine), returns results wrapped with source and enhanced flags.
    async searchPlans(
      query: string,
      limit?: number
    ): Promise<{ source: string; results: PlanResult[]; enhanced: boolean }> {
      // Plans are local to the machine, no Desktop integration needed
      const plans = await this.claudeCodeEngine.searchPlans(query, limit || 10);
    
      return {
        source: 'claude-code',
        results: plans,
        enhanced: false,
      };
    }
  • Formatter label/comment indicating handling for search_plans output formatting via formatPlanSearch method.
    plans: '[⌐▣_▣]', // search_plans
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches for 'past implementation approaches, decisions, and patterns,' implying a read-only operation, but doesn't cover critical aspects like authentication needs, rate limits, error handling, or response format. For a search tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 front-loads the core purpose without unnecessary words. Every part of the sentence ('Search Claude Code plan files for past implementation approaches, decisions, and patterns') contributes directly to understanding the tool's function, making it appropriately concise and well-structured.

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 moderate complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the purpose but lacks usage guidelines, behavioral details, and output information. Without annotations or an output schema, the agent has incomplete context for effective tool invocation, though the schema provides good parameter coverage.

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 description coverage is 100%, so the schema fully documents all three parameters (query, limit, detail_level) with descriptions, defaults, and an enum. The description adds no additional parameter semantics beyond what's in the schema, such as query syntax examples or detail-level implications. This meets the baseline score of 3 when schema coverage is high.

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 tool's purpose: 'Search Claude Code plan files for past implementation approaches, decisions, and patterns.' It specifies the verb ('Search'), resource ('Claude Code plan files'), and target content ('implementation approaches, decisions, and patterns'). However, it doesn't explicitly differentiate from sibling tools like 'search_conversations' or 'find_tool_patterns,' which might have overlapping search domains.

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 'search_conversations' or 'find_tool_patterns,' nor does it specify contexts, prerequisites, or exclusions for usage. The agent must infer usage from the purpose alone.

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/Vvkmnn/claude-historian'

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