Skip to main content
Glama

call_api_endpoint

Execute API requests on the Hive Intelligence server by specifying the endpoint name and required arguments, ensuring compliance with the provided schema.

Instructions

call an endpoint in the HIVE API. Note: use the category endpoints to get the list of endpoints and get_api_endpoint_schema tool to get the schema for an endpoint.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsYesThe arguments to pass to the endpoint. This must match the schema returned by the `get_api_endpoint_schema` tool.
endpoint_nameYesThe name of the endpoint to call.

Implementation Reference

  • Specific handler logic for 'call_api_endpoint' within the dynamicToolsHandler method. It extracts endpoint_name and args from the request, proxies the call to the HIVE API execute endpoint via fetch, handles the response, and formats it as MCP content.
    if(request.params.name == "call_api_endpoint"){ const toolName:any= request.params.arguments?.endpoint_name try { // Call the API server's /execute endpoint const response = await fetch(API_EXECUTE_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ toolName: toolName, arguments: request.params.arguments?.args }) }); const result = await response.json(); if (!response.ok) { return { content: [ { type: "text", text: `Error executing hive tool: ${result.error || 'Request failed'}`, }, ], }; } return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error executing hive tool: ${error}`, }, ], }; }
  • Zod schema defining the input validation for the 'call_api_endpoint' tool: endpoint_name (string) and args (record of string to any).
    const callEndpointSchema = z.object({ endpoint_name: z.string().describe('The name of the endpoint to call.'), args: z .record(z.string(), z.any()) .describe( 'The arguments to pass to the endpoint. This must match the schema returned by the `get_api_endpoint_schema` tool.', ), });
  • Tool registration object for 'call_api_endpoint' including metadata, tool definition with name, description, inputSchema, and placeholder handler (null, handled specially elsewhere).
    const callEndpointTool = { metadata: { resource: 'dynamic_tools', operation: 'write' as const, tags: [], }, tool: { name: 'call_api_endpoint', description: 'call an endpoint in the HIVE API. Note: use the category endpoints to get the list of endpoints and `get_api_endpoint_schema` tool to get the schema for an endpoint.', inputSchema: zodToInputSchema(callEndpointSchema), }, handler: null };
  • The dynamicTools function returns an array including the callEndpointTool, which is then processed and registered in the MCP server tools list.
    return [getEndpointTool, callEndpointTool, ...categoryTools];

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/hive-intel/hive-crypto-mcp'

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