Skip to main content
Glama

project_health_check

Check the operational status of a specific project instance to identify issues and ensure proper functionality.

Instructions

Check health of specific project instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject identifier to check health for

Implementation Reference

  • MCP tool registration for 'project_health_check', including schema (projectId string) and thin async handler that calls projectManager.checkProjectHealth(projectId) and formats response.
    server.tool(
      "project_health_check",
      "Check health of specific project instance",
      {
        projectId: z.string().describe("Project identifier to check health for")
      },
      async ({ projectId }) => {
        try {
          const result = await projectManager.checkProjectHealth(projectId);
          
          if (result.success) {
            const health = result.health;
            const uptime = Math.floor((health.uptime || 0) / 1000);
            
            return {
              content: [
                {
                  type: "text", 
                  text: `πŸ’š **Health Check - ${health.projectName}**\n\nβœ… **Status:** Salutare\nπŸ”„ **Uptime:** ${uptime}s\n⚑ **Performance:** ${health.response_time_ms}ms\nπŸ“Š **Memory Usage:** ${health.memory_mb}MB\nπŸ“‚ **Progetto Caricato:** ${health.project_loaded ? 'βœ…' : '❌'}\nπŸ”— **Network:** ${health.network_ready ? 'βœ…' : '❌'}`
                }
              ]
            };
          } else {
            return {
              content: [
                {
                  type: "text",
                  text: `❌ **Health Check Fallito**\n\n${result.error}`
                }
              ]
            };
          }
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `❌ **Errore:** ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Core handler logic in ProjectInstanceManager.checkProjectHealth: retrieves project instance, calls controller.checkInstanceHealth, aggregates with project-specific info like uptime, name.
    public async checkProjectHealth(projectId: string): Promise<{
      success: boolean;
      health?: any;
      error?: string;
    }> {
      const instance = this.projectInstances.get(projectId);
      
      if (!instance || !instance.isActive) {
        return {
          success: false,
          error: `Project instance ${projectId} not active`
        };
      }
    
      try {
        const healthResult = await instance.controller.checkInstanceHealth();
        
        return {
          success: healthResult.success,
          health: {
            ...healthResult.result,
            projectName: instance.config.name,
            uptime: Date.now() - (instance.startTime || Date.now()),
            lastUsed: instance.lastUsed
          },
          error: healthResult.error
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : String(error)
        };
      }
    }
  • Supporting health check in PersistentVisumController: sends 'ping' JSON command to persistent Python VisumPy process via stdin, awaits 'pong' response with stats like requestCount, projectLoaded.
    public async checkInstanceHealth(): Promise<VisumResponse> {
      if (!this.isInstanceActive || !this.persistentProcess || this.persistentProcess.killed) {
        return {
          success: false,
          error: "Persistent process not running"
        };
      }
    
      const requestId = (++this.requestCounter).toString();
      
      return new Promise((resolve, reject) => {
        // Store the request
        this.pendingRequests.set(requestId, { resolve, reject });
        
        // Send ping command
        const pingCommand = {
          type: 'ping',
          id: requestId,
          timestamp: Date.now()
        };
        
        const commandJson = JSON.stringify(pingCommand) + '\n';
        console.error(`🩺 Sending health check ${requestId}`);
        this.persistentProcess?.stdin?.write(commandJson);
        
        // Set timeout for ping
        setTimeout(() => {
          if (this.pendingRequests.has(requestId)) {
            this.pendingRequests.delete(requestId);
            resolve({
              success: false,
              error: "Health check timeout"
            });
          }
        }, 5000); // 5 second timeout for ping
      });
    }

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