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) }] }; }

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