Skip to main content
Glama

check-status

Verify URL accessibility by performing HEAD requests to check if web resources are reachable and responsive.

Instructions

Check if a URL is accessible (HEAD request)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to check
timeoutNoRequest timeout in milliseconds

Implementation Reference

  • The handler function that executes the check-status tool logic: sends a HEAD request to the URL and returns status information, headers, and availability.
    async function handleCheckStatus(args: CheckStatusArgs): Promise<z.infer<typeof CallToolResultSchema>> {
      try {
        const { url, timeout } = args;
        
        console.error(`Checking status of ${url}`);
        
        // Create request options
        const options: any = {
          method: "HEAD",
        };
        
        if (timeout) {
          // @ts-ignore - undici specific options
          options.headersTimeout = timeout;
        }
        
        // Perform the request
        const response = await fetch(url, options);
        
        // Create a result object
        const result = {
          status: response.status,
          statusText: response.statusText,
          headers: Object.fromEntries(response.headers.entries()),
          url: response.url,
          isAvailable: response.ok,
        };
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      } catch (error) {
        console.error(`Error checking URL status:`, error);
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error checking URL status: ${(error as Error).message}`
            }
          ]
        };
      }
    }
    
    // Start the server using stdio transport
  • Zod schema used for input validation in the check-status handler.
    const CheckStatusArgsSchema = z.object({
      url: z.string().url().describe("URL to check"),
      timeout: z.number().positive().optional().describe("Request timeout in milliseconds")
    });
  • src/index.ts:120-131 (registration)
    Tool registration in the TOOLS array, defining name, description, and JSON input schema.
    {
      name: "check-status",
      description: "Check if a URL is accessible (HEAD request)",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string", description: "URL to check" },
          timeout: { type: "number", description: "Request timeout in milliseconds" }
        },
        required: ["url"]
      }
    }
  • TypeScript type definition for check-status arguments inferred from the Zod schema.
    type CheckStatusArgs = z.infer<typeof CheckStatusArgsSchema>;
  • src/index.ts:163-164 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes to the check-status handler.
    case "check-status":
      return handleCheckStatus(CheckStatusArgsSchema.parse(args));
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/mcollina/mcp-node-fetch'

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