Skip to main content
Glama

find_files_with_metadata

Locate files containing AI metadata to identify data sources and track AI-generated content within projects.

Instructions

Find all files that contain AI metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternNoFile pattern to search (optional)

Implementation Reference

  • Core handler function that searches for files matching the given pattern (defaulting to common source files), parses AI metadata in each file using parseFileMetadata, and returns the absolute paths of files that contain valid AI metadata.
    async findFilesWithMetadata(pattern: string = '**/*.{js,ts,jsx,tsx,py,java,cpp,c,h}'): Promise<string[]> {
      try {
        const files = await glob(pattern, { 
          cwd: this.projectRoot,
          absolute: true,
          ignore: ['**/node_modules/**', '**/dist/**', '**/.git/**']
        });
        
        const filesWithMetadata: string[] = [];
        
        for (const file of files) {
          const metadata = await this.parseFileMetadata(file);
          if (metadata) {
            filesWithMetadata.push(file);
          }
        }
        
        return filesWithMetadata;
      } catch (error) {
        console.error(chalk.red('Error finding files with metadata:'), error);
        return [];
      }
    }
  • Input schema definition for the tool, specifying an optional 'pattern' parameter of type string for glob pattern matching.
    inputSchema: {
      type: 'object',
      properties: {
        pattern: { type: 'string', description: 'File pattern to search (optional)' }
      }
    }
  • src/index.ts:676-684 (registration)
    Tool registration in the MCP server's ListTools handler, defining the tool name, description, and input schema.
      name: 'find_files_with_metadata',
      description: 'Find all files that contain AI metadata',
      inputSchema: {
        type: 'object',
        properties: {
          pattern: { type: 'string', description: 'File pattern to search (optional)' }
        }
      }
    },
  • Dispatch handler in the MCP server's CallToolRequestHandler that extracts the pattern argument, calls the metadataParser's findFilesWithMetadata method, and returns the result as JSON string in the MCP response format.
    case 'find_files_with_metadata': {
      const pattern = args.pattern as string | undefined;
      const files = await this.metadataParser.findFilesWithMetadata(pattern);
      return { content: [{ type: 'text', text: JSON.stringify(files, null, 2) }] };
    }
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 finds files with AI metadata but doesn't describe what 'AI metadata' entails, how results are returned (e.g., list format, pagination), or any constraints like rate limits or permissions required. For a search tool with zero annotation coverage, this is a significant gap, warranting a score of 2.

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: 'Find all files that contain AI metadata.' It is front-loaded with the core purpose, has no unnecessary words, and every part earns its place by specifying the action and target. This is appropriately sized for a simple tool, scoring a 5.

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

Completeness2/5

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

Given the tool's complexity (a search operation with no annotations and no output schema), the description is incomplete. It doesn't explain what 'AI metadata' means, how results are structured, or any behavioral aspects like search scope or limitations. Without annotations or output schema to fill these gaps, the description should provide more context, but it falls short, resulting in a score of 2.

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?

The input schema has 100% description coverage, with one optional parameter 'pattern' documented as 'File pattern to search (optional).' The description doesn't add any meaning beyond this, such as examples of patterns or how they interact with AI metadata. Given the high schema coverage, the baseline is 3, as the schema handles parameter documentation adequately.

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: 'Find all files that contain AI metadata.' It specifies the verb ('Find') and resource ('files'), and distinguishes it from siblings like 'parse_file_metadata' or 'get_file_changelog' by focusing on searching rather than parsing or retrieving logs. However, it doesn't explicitly differentiate from 'get_recent_changes' or other search-related tools, keeping it at a 4 instead of a 5.

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 prerequisites, such as whether files need to be indexed or accessible, or compare it to siblings like 'get_recent_changes' for time-based searches. Without any usage context or exclusions, it scores a 2.

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/keleshteri/mcp-memory'

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