Skip to main content
Glama
husamabusafa

Advanced Hasura GraphQL MCP Server

by husamabusafa

health_check

Verify the reachability of a Hasura GraphQL endpoint by testing its health status using a specific HTTP URL to ensure operational reliability.

Instructions

Checks if the configured Hasura GraphQL endpoint is reachable...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
healthEndpointUrlNoOptional. A specific HTTP health check URL...

Implementation Reference

  • The asynchronous handler function that executes the health_check tool. It checks the Hasura GraphQL endpoint reachability using a simple GraphQL query or an optional HTTP health endpoint via fetch.
    async ({ healthEndpointUrl }) => {
      console.log(`[INFO] Executing tool 'health_check'...`);
      try {
          let resultText = "";
          if (healthEndpointUrl) {
              console.log(`[DEBUG] Performing HTTP GET to: ${healthEndpointUrl}`);
              const response = await fetch(healthEndpointUrl, { method: 'GET' });
              resultText = `Health endpoint ${healthEndpointUrl} status: ${response.status} ${response.statusText}`;
               if (!response.ok) throw new Error(resultText);
          } else {
              console.log(`[DEBUG] Performing GraphQL query { __typename } to: ${HASURA_ENDPOINT}`);
              const query = gql`query HealthCheck { __typename }`;
              const result = await makeGqlRequest(query);
              resultText = `GraphQL endpoint ${HASURA_ENDPOINT} is responsive. Result: ${JSON.stringify(result)}`;
          }
           return { content: [{ type: "text", text: `Health check successful. ${resultText}` }] };
      } catch (error: any) {
          console.error(`[ERROR] Tool 'health_check' failed: ${error.message}`);
           return { content: [{ type: "text", text: `Health check failed: ${error.message}` }], isError: false }; 
      }
    }
  • Zod schema defining the input parameters for the health_check tool: an optional URL for a specific health endpoint.
    {
      healthEndpointUrl: z.string().url().optional().describe("Optional. A specific HTTP health check URL...")
    },
  • src/index.ts:438-465 (registration)
    The server.tool() call that registers the 'health_check' tool, including its name, description, input schema, and handler function.
    server.tool(
      "health_check",
      "Checks if the configured Hasura GraphQL endpoint is reachable...",
      {
        healthEndpointUrl: z.string().url().optional().describe("Optional. A specific HTTP health check URL...")
      },
      async ({ healthEndpointUrl }) => {
        console.log(`[INFO] Executing tool 'health_check'...`);
        try {
            let resultText = "";
            if (healthEndpointUrl) {
                console.log(`[DEBUG] Performing HTTP GET to: ${healthEndpointUrl}`);
                const response = await fetch(healthEndpointUrl, { method: 'GET' });
                resultText = `Health endpoint ${healthEndpointUrl} status: ${response.status} ${response.statusText}`;
                 if (!response.ok) throw new Error(resultText);
            } else {
                console.log(`[DEBUG] Performing GraphQL query { __typename } to: ${HASURA_ENDPOINT}`);
                const query = gql`query HealthCheck { __typename }`;
                const result = await makeGqlRequest(query);
                resultText = `GraphQL endpoint ${HASURA_ENDPOINT} is responsive. Result: ${JSON.stringify(result)}`;
            }
             return { content: [{ type: "text", text: `Health check successful. ${resultText}` }] };
        } catch (error: any) {
            console.error(`[ERROR] Tool 'health_check' failed: ${error.message}`);
             return { content: [{ type: "text", text: `Health check failed: ${error.message}` }], isError: false }; 
        }
      }
    );
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 checking reachability but doesn't specify what 'reachable' entails (e.g., HTTP status codes, timeouts, authentication requirements). For a diagnostic tool with zero annotation coverage, this leaves critical behavioral traits like error handling or performance implications unclear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary details. It's appropriately sized and front-loaded, though it could be slightly more structured by including usage hints. Overall, it earns its place without waste.

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 tool's diagnostic nature and lack of annotations or output schema, the description is incomplete. It doesn't explain what the check entails (e.g., network connectivity, endpoint response validation) or what results to expect (e.g., success/failure indicators). For a tool with no structured output documentation, more context is needed to guide effective use.

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?

Schema description coverage is 100%, so the schema already documents the single parameter 'healthEndpointUrl' with its description and format. The description doesn't add any meaning beyond what the schema provides, such as explaining default behavior when the parameter is omitted. Baseline 3 is appropriate when the schema handles parameter documentation adequately.

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: 'Checks if the configured Hasura GraphQL endpoint is reachable...' This specifies the verb ('checks') and resource ('Hasura GraphQL endpoint'), though it doesn't explicitly differentiate from siblings like 'run_graphql_query' which might also test connectivity indirectly. The purpose is clear but lacks sibling differentiation.

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, such as needing a configured endpoint, or compare it to siblings like 'run_graphql_query' that might serve similar diagnostic purposes. Without such context, users must infer usage scenarios.

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

Related 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/husamabusafa/hasura_mcp'

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