Skip to main content
Glama

check-api-status

Verify API connectivity and validate API keys to ensure proper access to Orshot's image generation services.

Instructions

Check the API connectivity and validate the API key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiKeyNoOrshot API key for authentication (optional if set in environment)

Implementation Reference

  • src/index.ts:1435-1541 (registration)
    Registration of the 'check-api-status' tool using server.tool, including the name, description, input schema, and handler function.
    server.tool(
      "check-api-status",
      "Check the API connectivity and validate the API key",
      {
        apiKey: z.string().optional().describe("Orshot API key for authentication (optional if set in environment)"),
      },
      async (args) => {
        const { apiKey } = args;
        const actualApiKey = apiKey || DEFAULT_API_KEY;
        
        if (!actualApiKey) {
          return {
            content: [
              {
                type: "text",
                text: "āŒ No API key provided. Please provide an API key parameter or set ORSHOT_API_KEY environment variable.",
              },
            ],
          };
        }
    
        try {
          // Test API connectivity with a simple endpoint
          const response = await fetch(`${ORSHOT_API_BASE}/v1/templates`, {
            method: "GET",
            headers: {
              "Authorization": `Bearer ${actualApiKey}`,
              "Content-Type": "application/json",
            },
          });
    
          const statusCode = response.status;
          const statusText = response.statusText;
    
          if (response.ok) {
            const data = await response.json();
            const templateCount = Array.isArray(data) ? data.length : 0;
            
            return {
              content: [
                {
                  type: "text",
                  text: `āœ… API Status: Connected successfully!
    šŸ”‘ API Key: Valid
    šŸ“Š Status Code: ${statusCode} ${statusText}
    šŸ“ Templates Found: ${templateCount}
    🌐 API Base URL: ${ORSHOT_API_BASE}
    
    Your Orshot API integration is working correctly.`,
                },
              ],
            };
          } else {
            let errorMessage = `HTTP ${statusCode} ${statusText}`;
            
            try {
              const errorData = await response.text();
              const parsedError = JSON.parse(errorData);
              if (parsedError.message) {
                errorMessage = parsedError.message;
              } else if (parsedError.error) {
                errorMessage = parsedError.error;
              }
            } catch {
              // If we can't parse the error, use the raw response
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: `āŒ API Status: Connection failed
    šŸ”‘ API Key: ${statusCode === 401 ? 'Invalid or expired' : 'Potentially valid'}
    šŸ“Š Status Code: ${statusCode} ${statusText}
    🌐 API Base URL: ${ORSHOT_API_BASE}
    ā— Error: ${errorMessage}
    
    ${statusCode === 401 ? 'Please check your API key.' : 
      statusCode === 403 ? 'API key valid but insufficient permissions.' :
      statusCode === 404 ? 'API endpoint not found.' :
      statusCode >= 500 ? 'Orshot server error. Try again later.' :
      'Unknown error occurred.'}`,
                },
              ],
            };
          }
    
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `āŒ API Status: Network error
    🌐 API Base URL: ${ORSHOT_API_BASE}
    ā— Error: ${error instanceof Error ? error.message : 'Unknown network error'}
    
    This could be due to:
    - Network connectivity issues
    - Firewall blocking the request
    - DNS resolution problems
    - Orshot service unavailable`,
              },
            ],
          };
        }
      }
    );
  • Handler function that performs the actual tool logic: validates API key presence, makes a GET request to Orshot API /v1/templates endpoint to test connectivity and authentication, and returns a formatted status report including success/failure details.
      async (args) => {
        const { apiKey } = args;
        const actualApiKey = apiKey || DEFAULT_API_KEY;
        
        if (!actualApiKey) {
          return {
            content: [
              {
                type: "text",
                text: "āŒ No API key provided. Please provide an API key parameter or set ORSHOT_API_KEY environment variable.",
              },
            ],
          };
        }
    
        try {
          // Test API connectivity with a simple endpoint
          const response = await fetch(`${ORSHOT_API_BASE}/v1/templates`, {
            method: "GET",
            headers: {
              "Authorization": `Bearer ${actualApiKey}`,
              "Content-Type": "application/json",
            },
          });
    
          const statusCode = response.status;
          const statusText = response.statusText;
    
          if (response.ok) {
            const data = await response.json();
            const templateCount = Array.isArray(data) ? data.length : 0;
            
            return {
              content: [
                {
                  type: "text",
                  text: `āœ… API Status: Connected successfully!
    šŸ”‘ API Key: Valid
    šŸ“Š Status Code: ${statusCode} ${statusText}
    šŸ“ Templates Found: ${templateCount}
    🌐 API Base URL: ${ORSHOT_API_BASE}
    
    Your Orshot API integration is working correctly.`,
                },
              ],
            };
          } else {
            let errorMessage = `HTTP ${statusCode} ${statusText}`;
            
            try {
              const errorData = await response.text();
              const parsedError = JSON.parse(errorData);
              if (parsedError.message) {
                errorMessage = parsedError.message;
              } else if (parsedError.error) {
                errorMessage = parsedError.error;
              }
            } catch {
              // If we can't parse the error, use the raw response
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: `āŒ API Status: Connection failed
    šŸ”‘ API Key: ${statusCode === 401 ? 'Invalid or expired' : 'Potentially valid'}
    šŸ“Š Status Code: ${statusCode} ${statusText}
    🌐 API Base URL: ${ORSHOT_API_BASE}
    ā— Error: ${errorMessage}
    
    ${statusCode === 401 ? 'Please check your API key.' : 
      statusCode === 403 ? 'API key valid but insufficient permissions.' :
      statusCode === 404 ? 'API endpoint not found.' :
      statusCode >= 500 ? 'Orshot server error. Try again later.' :
      'Unknown error occurred.'}`,
                },
              ],
            };
          }
    
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `āŒ API Status: Network error
    🌐 API Base URL: ${ORSHOT_API_BASE}
    ā— Error: ${error instanceof Error ? error.message : 'Unknown network error'}
    
    This could be due to:
    - Network connectivity issues
    - Firewall blocking the request
    - DNS resolution problems
    - Orshot service unavailable`,
              },
            ],
          };
        }
      }
  • Input schema using Zod: optional apiKey string parameter.
      apiKey: z.string().optional().describe("Orshot API key for authentication (optional if set in environment)"),
    },
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 mentions authentication validation but doesn't describe what happens during the check (e.g., what tests are performed, what response indicates success/failure, rate limits, or error conditions). For a connectivity validation 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 a single, efficient sentence with zero wasted words. It's appropriately sized for a simple tool and front-loads the core purpose immediately.

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?

For a simple connectivity check tool with 100% schema coverage but no annotations and no output schema, the description is adequate but has clear gaps. It covers the basic purpose but lacks details about behavioral aspects, response format, and error handling that would be helpful for an agent.

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. The description adds marginal value by mentioning authentication validation context but doesn't provide additional syntax, format, or usage details beyond what the schema provides. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Check') and resource ('API connectivity'), and distinguishes it from sibling tools focused on image generation and template retrieval by focusing on API health validation. It provides a complete verb+resource+scope combination.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context (validating API connectivity and key) but doesn't explicitly state when to use this tool versus alternatives or when not to use it. It provides clear functional purpose but lacks explicit comparative guidance with sibling tools.

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/rishimohan/orshot-mcp-server'

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