Skip to main content
Glama

project_execute_analysis

Analyze project data by executing Python code generated from natural language requests to extract insights and metrics.

Instructions

Execute intelligent analysis on specific project instance with ultra-fast performance. Automatically generates Python code based on analysis request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject identifier to execute analysis on
analysisRequestYesNatural language description of the analysis you want to perform (e.g., 'get network statistics', 'analyze node distribution', 'check link lengths')
returnFormatNoFormat of results: summary (key metrics), detailed (comprehensive), raw (full data)summary

Implementation Reference

  • MCP server.tool registration for 'project_execute_analysis', including input schema (Zod), description, and inline handler function that delegates execution to projectManager.executeProjectAnalysis and formats the response.
    server.tool( "project_execute_analysis", "Execute analysis on specific project instance with ultra-fast performance", { projectId: z.string().describe("Project identifier to execute analysis on"), analysisCode: z.string().describe("Python code to execute on the project instance"), description: z.string().optional().describe("Optional description of the analysis") }, async ({ projectId, analysisCode, description }) => { try { const result = await projectManager.executeProjectAnalysis(projectId, analysisCode, description); if (result.success) { return { content: [ { type: "text", text: `šŸš€ **Analisi Completata** (${result.projectInfo?.projectName})\n\n⚔ **Tempo esecuzione:** ${result.executionTimeMs}ms\n\nšŸ“Š **Risultati:**\n\`\`\`json\n${JSON.stringify(result.result, null, 2)}\n\`\`\`` } ] }; } else { return { content: [ { type: "text", text: `āŒ **Errore Analisi**\n\n${result.error}` } ] }; } } catch (error) { return { content: [ { type: "text", text: `āŒ **Errore:** ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
  • Core handler method in ProjectInstanceManager that retrieves the project instance, validates it's active, and delegates to executeOnInstance for executing the analysis code via the instance's controller.
    public async executeProjectAnalysis(projectId: string, analysisCode: string, description?: string): Promise<{ success: boolean; result?: any; error?: string; executionTimeMs?: number; projectInfo?: any; }> { const instance = this.projectInstances.get(projectId); if (!instance || !instance.isActive) { return { success: false, error: `Instance '${projectId}' is not active. Use 'project_start_instance' to start it first.` }; } return this.executeOnInstance(instance, analysisCode, description); }
  • Private helper method that updates last used time, executes the analysis code using the project instance's controller.executeCustomCode, and packages the result with project info.
    private async executeOnInstance(instance: ProjectInstance, analysisCode: string, description?: string): Promise<{ success: boolean; result?: any; error?: string; executionTimeMs?: number; projectInfo?: any; }> { try { instance.lastUsed = Date.now(); const result = await instance.controller.executeCustomCode(analysisCode, description); return { success: result.success, result: result.result, error: result.error, executionTimeMs: result.executionTimeMs, projectInfo: { projectName: instance.config.name, projectId: instance.config.name.toLowerCase(), stats: instance.stats } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }

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/multiluca2020/visum-thinker-mcp-server'

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