Skip to main content
Glama

list_key_files

Identify and categorize essential project files like entry points, configuration files, and documentation to understand project structure and organization.

Instructions

List key files in a project, categorized by purpose: entry points, config files, and documentation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the project directory

Implementation Reference

  • Core handler function implementing list_key_files tool: validates path, scans tree, detects languages/entry points/config/docs, returns categorized key files.
    export async function listKeyFiles({ path: projectPath }) { // Validate path exists try { const stats = await fs.stat(projectPath); if (!stats.isDirectory()) { return createError(ErrorCodes.PATH_NOT_DIRECTORY); } } catch (err) { if (err.code === 'ENOENT') { return createError(ErrorCodes.PATH_NOT_FOUND); } if (err.code === 'EACCES') { return createError(ErrorCodes.ACCESS_DENIED); } return createError(ErrorCodes.SCAN_ERROR, err.message); } try { // Quick scan const { files } = await scanTree(projectPath, { maxDepth: 2, maxFiles: 500 }); const sigs = await getSignatures(); // Detect languages for entry point detection const languages = await detectLanguages(projectPath, files); // Find entry points const entryPoints = await detectEntryPoints(projectPath, files, languages); // Find config files const configFiles = files.filter(f => { const basename = path.basename(f); return sigs.configFiles.some(cf => basename === cf || f.endsWith(cf)); }); // Find doc files const docFiles = files.filter(f => { const basename = path.basename(f).toLowerCase(); return sigs.docFiles.some(df => { if (df.endsWith('/')) { // Directory pattern return f.toLowerCase().startsWith(df.slice(0, -1)); } return basename === df.toLowerCase(); }); }); // Build result (omit empty arrays) const result = {}; if (entryPoints.length > 0) { result.entry = entryPoints; } if (configFiles.length > 0) { result.config = configFiles; } if (docFiles.length > 0) { result.docs = docFiles; } return result; } catch (err) { return createError(ErrorCodes.SCAN_ERROR, err.message); } }
  • Input schema definition using Zod for the path parameter.
    export const listKeyFilesSchema = { path: z.string().describe("Path to the project directory") };
  • index.js:67-85 (registration)
    MCP server registration of list_key_files tool with schema and wrapper handler that formats output as MCP content.
    server.registerTool( "list_key_files", { title: "List Key Files", description: "List key files in a project, categorized by purpose: entry points, config files, and documentation.", inputSchema: listKeyFilesSchema }, async (params) => { const result = await listKeyFiles(params); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } );
  • server.js:58-69 (registration)
    Tool definition and registration in HTTP/SSE server, with inline schema and direct handler reference.
    list_key_files: { name: "list_key_files", description: "List key files in a project, categorized by purpose: entry points, config files, and documentation.", inputSchema: { type: "object", properties: { path: { type: "string", description: "Path to the project directory" } }, required: ["path"] }, handler: listKeyFiles }
  • api/index.js:10-13 (registration)
    Simple tool mapping in serverless API handler for direct tool calls.
    const tools = { inspect_project: inspectProject, detect_stack: detectStack, list_key_files: listKeyFiles

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/QoutaID/qoutaMcp'

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