Skip to main content
Glama

health_check

Monitor server health, verify tool availability, and assess environment status for mobile development workflows.

Instructions

Check server health, tool availability and environment status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
verboseNoInclude detailed tool analysis and recommendations

Implementation Reference

  • The core handler function for the 'health_check' tool. It validates the environment, maps tool availability, generates a health report using generateHealthCheckReport, and optionally provides detailed analysis of working/broken tools.
    handler: async (args: any) => {
      const env = await validateEnvironment();
      const verbose = args?.verbose || false;
      
      // Convert env.availableTools to match RequiredTool enum format
      const toolAvailability: Record<string, boolean> = {};
      for (const [toolName, isAvailable] of Object.entries(env.availableTools)) {
        // Map common tool names to RequiredTool enum values
        const mappedToolName = toolName === 'native-run' ? RequiredTool.NATIVE_RUN : 
                               toolName === 'adb' ? RequiredTool.ADB :
                               toolName === 'flutter' ? RequiredTool.FLUTTER :
                               toolName === 'xcrun' ? RequiredTool.XCRUN :
                               toolName === 'xcodebuild' ? RequiredTool.XCODEBUILD :
                               toolName as RequiredTool;
        toolAvailability[mappedToolName] = isAvailable as boolean;
      }
      
      const healthReport = generateHealthCheckReport(toolAvailability);
      
      const baseHealth = {
        success: true,
        data: {
          server: 'mcp-mobile-server',
          version: '1.0.0',
          status: 'healthy',
          timestamp: new Date().toISOString(),
          registeredTools: tools.size,
          environment: env,
          toolHealth: {
            totalAvailable: healthReport.totalTools,
            expectedWorking: healthReport.expectedWorkingTools,
            safeForTesting: healthReport.safeForTesting,
            byCategory: healthReport.categoryCounts,
            byPlatform: healthReport.platformCounts,
          },
          activeProcesses: Array.from(globalProcessMap.entries()).map(([key, pid]) => ({
            key,
            pid
          }))
        }
      };
    
      if (verbose) {
        // Add detailed analysis
        const workingTools = Object.entries(TOOL_REGISTRY).filter(([_, toolInfo]) => {
          return toolInfo.requiredTools.every(req => toolAvailability[req]);
        });
    
        const brokenTools = Object.entries(TOOL_REGISTRY).filter(([_, toolInfo]) => {
          return !toolInfo.requiredTools.every(req => toolAvailability[req]);
        });
    
        (baseHealth.data as any).detailedAnalysis = {
          workingTools: workingTools.map(([name, info]) => ({
            name,
            category: info.category,
            platform: info.platform,
            description: info.description,
            safeForTesting: info.safeForTesting
          })),
          brokenTools: brokenTools.map(([name, info]) => ({
            name,
            category: info.category,
            platform: info.platform,
            description: info.description,
            missingRequirements: info.requiredTools.filter(req => !toolAvailability[req])
          })),
          recommendations: await fallbackManager.generateFallbackRecommendations()
        };
      }
    
      return baseHealth;
    }
  • Input schema for the health_check tool, defining an optional 'verbose' boolean parameter.
    inputSchema: {
      type: 'object',
      properties: {
        verbose: {
          type: 'boolean',
          description: 'Include detailed tool analysis and recommendations'
        }
      },
      required: []
    },
  • src/server.ts:73-160 (registration)
    Registration of the 'health_check' tool in the MCP tools Map, including name, description, schema, and handler.
    // Register health check tool
    tools.set('health_check', {
      name: 'health_check',
      description: 'Check server health, tool availability and environment status',
      inputSchema: {
        type: 'object',
        properties: {
          verbose: {
            type: 'boolean',
            description: 'Include detailed tool analysis and recommendations'
          }
        },
        required: []
      },
      handler: async (args: any) => {
        const env = await validateEnvironment();
        const verbose = args?.verbose || false;
        
        // Convert env.availableTools to match RequiredTool enum format
        const toolAvailability: Record<string, boolean> = {};
        for (const [toolName, isAvailable] of Object.entries(env.availableTools)) {
          // Map common tool names to RequiredTool enum values
          const mappedToolName = toolName === 'native-run' ? RequiredTool.NATIVE_RUN : 
                                 toolName === 'adb' ? RequiredTool.ADB :
                                 toolName === 'flutter' ? RequiredTool.FLUTTER :
                                 toolName === 'xcrun' ? RequiredTool.XCRUN :
                                 toolName === 'xcodebuild' ? RequiredTool.XCODEBUILD :
                                 toolName as RequiredTool;
          toolAvailability[mappedToolName] = isAvailable as boolean;
        }
        
        const healthReport = generateHealthCheckReport(toolAvailability);
        
        const baseHealth = {
          success: true,
          data: {
            server: 'mcp-mobile-server',
            version: '1.0.0',
            status: 'healthy',
            timestamp: new Date().toISOString(),
            registeredTools: tools.size,
            environment: env,
            toolHealth: {
              totalAvailable: healthReport.totalTools,
              expectedWorking: healthReport.expectedWorkingTools,
              safeForTesting: healthReport.safeForTesting,
              byCategory: healthReport.categoryCounts,
              byPlatform: healthReport.platformCounts,
            },
            activeProcesses: Array.from(globalProcessMap.entries()).map(([key, pid]) => ({
              key,
              pid
            }))
          }
        };
    
        if (verbose) {
          // Add detailed analysis
          const workingTools = Object.entries(TOOL_REGISTRY).filter(([_, toolInfo]) => {
            return toolInfo.requiredTools.every(req => toolAvailability[req]);
          });
    
          const brokenTools = Object.entries(TOOL_REGISTRY).filter(([_, toolInfo]) => {
            return !toolInfo.requiredTools.every(req => toolAvailability[req]);
          });
    
          (baseHealth.data as any).detailedAnalysis = {
            workingTools: workingTools.map(([name, info]) => ({
              name,
              category: info.category,
              platform: info.platform,
              description: info.description,
              safeForTesting: info.safeForTesting
            })),
            brokenTools: brokenTools.map(([name, info]) => ({
              name,
              category: info.category,
              platform: info.platform,
              description: info.description,
              missingRequirements: info.requiredTools.filter(req => !toolAvailability[req])
            })),
            recommendations: await fallbackManager.generateFallbackRecommendations()
          };
        }
    
        return baseHealth;
      }
    });
  • TOOL_REGISTRY entry defining metadata for the 'health_check' tool, such as category, platform, requirements, and performance expectations.
    'health_check': {
      name: 'health_check',
      category: ToolCategory.ESSENTIAL,
      platform: 'cross-platform',
      requiredTools: [],
      description: 'Check server health and tool availability',
      safeForTesting: true,
      performance: { expectedDuration: 1000, timeout: 10000 }
    },
  • Helper function that generates a detailed health check report based on available tools, counting by category, platform, requirements, safe testing tools, and expected working tools. Used by the health_check handler.
    export function generateHealthCheckReport(availableTools: Record<string, boolean>): HealthCheckReport {
      const allTools = Object.values(TOOL_REGISTRY);
      
      const categoryCounts = {
        [ToolCategory.ESSENTIAL]: 0,
        [ToolCategory.DEPENDENT]: 0,
        [ToolCategory.OPTIONAL]: 0,
      };
      
      const platformCounts: Record<string, number> = {};
      const requirementCounts: Partial<Record<RequiredTool, number>> = {};
      
      let safeForTesting = 0;
      let expectedWorkingTools = 0;
      
      allTools.forEach(tool => {
        // Count by category
        categoryCounts[tool.category]++;
        
        // Count by platform
        platformCounts[tool.platform] = (platformCounts[tool.platform] || 0) + 1;
        
        // Count by requirements
        tool.requiredTools.forEach(req => {
          requirementCounts[req] = (requirementCounts[req] || 0) + 1;
        });
        
        // Count safe for testing
        if (tool.safeForTesting) {
          safeForTesting++;
        }
        
        // Check if tool should work with available system tools
        const hasAllRequiredTools = tool.requiredTools.every(req => availableTools[req]);
        if (hasAllRequiredTools) {
          expectedWorkingTools++;
        }
      });
      
      return {
        totalTools: allTools.length,
        categoryCounts,
        platformCounts,
        requirementCounts,
        safeForTesting,
        expectedWorkingTools,
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool checks but doesn't describe how it performs these checks, what permissions are required, whether it's read-only or has side effects, what the output format is, or any rate limits. For a diagnostic tool with zero annotation coverage, this leaves significant behavioral gaps.

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 extremely concise - a single sentence with three clear components. Every word earns its place, and it's front-loaded with the core purpose. There's no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (health checking can involve multiple subsystems), no annotations, no output schema, and 100% parameter schema coverage, the description is minimally adequate. It tells what the tool does but lacks details about what 'health' means specifically, what tools are checked, or what the environment status includes. For a diagnostic tool in a mobile development context, more context would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't mention the 'verbose' parameter at all, but with 100% schema description coverage and only one optional parameter, the schema adequately documents it. The baseline for high schema coverage is 3, but with just one parameter that's well-described in the schema, the description's omission is less critical, warranting a slightly higher score.

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 with specific verbs ('check') and resources ('server health, tool availability and environment status'). It distinguishes from sibling tools by focusing on system diagnostics rather than Android/iOS/Flutter development operations. However, it doesn't explicitly differentiate from potential alternative health-check tools that might exist.

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 doesn't mention prerequisites, timing considerations, or what scenarios warrant its use. Given the sibling tools are all mobile development related, this health check tool likely serves a different context, but this isn't explained.

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/cristianoaredes/mcp-mobile-server'

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