Skip to main content
Glama

detect_stack

Analyze project directories to identify technology stacks, including runtime environments, frameworks, databases, and frontend components.

Instructions

Quickly detect the technology stack of a project. Faster and lighter than inspect_project, returns runtime, framework, database hints, and frontend info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the project directory

Implementation Reference

  • The primary handler function executing the detect_stack tool logic: validates path, scans files shallowly, detects languages/frameworks/databases/frontend, and returns stack info.
    export async function detectStack({ 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 with shallow depth
            const { files } = await scanTree(projectPath, {
                maxDepth: 2,
                maxFiles: 500
            });
    
            // Parse dependencies
            const dependencies = await parseDependencies(projectPath, files);
    
            // Detect languages
            const languages = await detectLanguages(projectPath, files);
    
            // Detect frameworks
            const frameworks = await detectFrameworks(projectPath, files, languages, dependencies);
    
            // Detect database hints
            const databaseHints = await detectDatabaseHints(dependencies);
    
            // Check for frontend
            const frontendFrameworks = ['React', 'Vue.js', 'Angular', 'Svelte', 'Next.js', 'Vite'];
            const frontend = frameworks
                .filter(f => frontendFrameworks.some(ff => f.name.includes(ff)))
                .map(f => f.name);
    
            // Build result
            const result = {
                runtime: languages.map(l => l.name)
            };
    
            if (frameworks.length > 0) {
                result.framework = frameworks.map(f => f.name);
            }
    
            if (databaseHints.length > 0) {
                result.databaseHints = databaseHints;
            }
    
            // Only include frontend if detected
            if (frontend.length > 0) {
                result.frontend = frontend;
            }
    
            return result;
    
        } catch (err) {
            return createError(ErrorCodes.SCAN_ERROR, err.message);
        }
    }
  • Input schema validation using Zod for the detect_stack tool, defining the required 'path' parameter.
    export const detectStackSchema = {
        path: z.string().describe("Path to the project directory")
    };
  • index.js:43-61 (registration)
    MCP tool registration in the main stdio MCP server, using detectStackSchema and wrapping detectStack handler for MCP content format.
    server.registerTool(
        "detect_stack",
        {
            title: "Detect Stack",
            description: "Quickly detect the technology stack of a project. Faster and lighter than inspect_project, returns runtime, framework, database hints, and frontend info.",
            inputSchema: detectStackSchema
        },
        async (params) => {
            const result = await detectStack(params);
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(result, null, 2),
                    },
                ],
            };
        }
    );
  • server.js:46-57 (registration)
    Tool definition/registration for HTTP/SSE server mode, with inline inputSchema and direct detectStack handler reference.
    detect_stack: {
        name: "detect_stack",
        description: "Quickly detect the technology stack of a project. Faster and lighter than inspect_project, returns runtime, framework, database hints, and frontend info.",
        inputSchema: {
            type: "object",
            properties: {
                path: { type: "string", description: "Path to the project directory" }
            },
            required: ["path"]
        },
        handler: detectStack
    },
  • api/index.js:10-13 (registration)
    Simple tool mapping for Vercel serverless API handler, directly assigning detectStack to detect_stack key.
    const tools = {
        inspect_project: inspectProject,
        detect_stack: detectStack,
        list_key_files: listKeyFiles
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