Skip to main content
Glama

List Key Files

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
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 mentions categorization by purpose, which adds some context, but fails to describe critical behaviors such as output format, error handling, permissions needed, or rate limits. For a tool with no annotations, this is a significant gap.

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 purpose and categorization without any wasted words. It is appropriately sized for the tool's complexity and structure.

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 lack of annotations and output schema, the description is incomplete. It does not explain what the tool returns (e.g., list format, categories), error conditions, or behavioral traits, leaving gaps for the agent to infer. This is inadequate for a tool with no structured support.

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 the 'path' parameter documented as 'Path to the project directory.' The description does not add any meaning beyond this, such as format examples or constraints, so it meets the baseline of 3 where the schema does the heavy lifting.

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: 'List key files in a project, categorized by purpose: entry points, config files, and documentation.' It specifies the verb ('List'), resource ('key files'), and scope ('in a project'), but does not explicitly differentiate from sibling tools like 'detect_stack' or 'inspect_project', which prevents a score of 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 lacks context about prerequisites, exclusions, or comparisons to sibling tools like 'detect_stack' and 'inspect_project', leaving the agent without clear usage direction.

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

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