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)"), },

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