Skip to main content
Glama

get_api_endpoint_schema

Retrieve the schema for an API endpoint in Hive Intelligence to structure and validate API calls using the call_api_endpoint tool.

Instructions

Get the schema for an endpoint in the HIVE API. You can use the schema returned by this tool to call an endpoint with the call_api_endpoint tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYesThe name of the endpoint to get the schema for.

Implementation Reference

  • The main handler function for the 'get_api_endpoint_schema' tool. It validates the input args using the Zod schema to extract the endpoint name, searches for the matching endpoint in the provided endpoints list, and returns the endpoint schema formatted as text content using the asTextContentResult helper.
    handler: async (args: Record<string, unknown> | undefined) => {
      if (!args) {
        throw new Error('No endpoint provided');
      }
      const endpointName = getEndpointSchema.parse(args).endpoint;
    
      // First, look in the original endpoints array
      let endpoint = endpoints.find((e) => e.name === endpointName);
      
      if (!endpoint) {
        throw new Error(`Endpoint ${endpointName} not found`);
      }
      return asTextContentResult(endpoint);
    },
  • Zod schema defining the input for the tool: an object with a required 'endpoint' string field describing the endpoint name.
    const getEndpointSchema = z.object({
      endpoint: z.string().describe('The name of the endpoint to get the schema for.'),
    });
  • The registration of the tool as getEndpointTool object, including metadata, tool definition with name, description, inputSchema, and the handler. This object is returned by dynamicTools() and registered in the MCP server.
    const getEndpointTool = {
      metadata: {
        resource: 'dynamic_tools',
        operation: 'read' as const,
        tags: [],
      },
      tool: {
        name: 'get_api_endpoint_schema',
        description:
          'Get the schema for an endpoint in the HIVE API. You can use the schema returned by this tool to call an endpoint with the `call_api_endpoint` tool.',
        inputSchema: zodToInputSchema(getEndpointSchema),
      },
      handler: async (args: Record<string, unknown> | undefined) => {
        if (!args) {
          throw new Error('No endpoint provided');
        }
        const endpointName = getEndpointSchema.parse(args).endpoint;
    
        // First, look in the original endpoints array
        let endpoint = endpoints.find((e) => e.name === endpointName);
        
        if (!endpoint) {
          throw new Error(`Endpoint ${endpointName} not found`);
        }
        return asTextContentResult(endpoint);
      },
    };
  • Helper function to format the result as MCP text content, with intelligent truncation for large responses to respect token limits.
    export function asTextContentResult(result: Object): any {
      // return {data: result}
      // Estimate token count (roughly 4 chars per token)
      const MAX_TOKENS = 25000;
      const CHARS_PER_TOKEN = 4;
      const maxChar = MAX_TOKENS * CHARS_PER_TOKEN; // ~100,000 chars for 25k tokens
      
      const jsonString = JSON.stringify(result, null, 2);
      
      if (jsonString.length > maxChar) {
        // Try to intelligently truncate if it's an array
        if (Array.isArray(result)) {
          const truncatedArray = result.slice(0, Math.floor(result.length * maxChar / jsonString.length));
          const truncatedJson = JSON.stringify({
            results: truncatedArray,
            truncated: true,
            originalLength: result.length,
            returnedLength: truncatedArray.length,
            message: "Response truncated due to size limits. Consider using pagination."
          }, null, 2);
          
          return {
            content: [
              {
                type: 'text',
                text: truncatedJson,
              },
            ],
          };
        }
        
        // For objects with results array
        if (typeof result === 'object' && result !== null && 'results' in result && Array.isArray((result as any).results)) {
          const originalResults = (result as any).results;
          const estimatedItemSize = jsonString.length / originalResults.length;
          const maxItems = Math.floor(maxChar / estimatedItemSize);
          
          const truncatedResult = {
            ...result,
            results: originalResults.slice(0, maxItems),
            truncated: true,
            originalCount: originalResults.length,
            returnedCount: maxItems,
            message: "Response truncated due to size limits. Use pagination parameters (limit/offset) for more results."
          };
          
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(truncatedResult, null, 2),
              },
            ],
          };
        }
        
        // Fallback to simple truncation
        const truncated = jsonString.substring(0, maxChar) + '\n... [TRUNCATED DUE TO SIZE LIMITS]';
        return {
          content: [
            {
              type: 'text',
              text: truncated,
            },
          ],
        };
      }
      
      return {
        content: [
          {
            type: 'text',
            text: jsonString,
          },
        ],
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool's function (retrieving schemas) and its relationship to another tool (call_api_endpoint), which adds useful context. However, it doesn't mention potential behavioral traits like error conditions (e.g., what happens if the endpoint doesn't exist), rate limits, authentication requirements, or the format/structure of the returned schema. For a tool with zero annotation coverage, this leaves gaps in understanding its operational behavior.

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 two sentences that are front-loaded with the core purpose and immediately followed by practical usage guidance. Every word earns its place—there's no redundancy, fluff, or unnecessary elaboration. It efficiently communicates both what the tool does and how it fits into the larger workflow.

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?

Given the tool's low complexity (1 parameter, no nested objects, no output schema) and the absence of annotations, the description is moderately complete. It covers the purpose and usage context well, but lacks details on behavioral aspects (e.g., error handling, schema format) and doesn't clarify differentiation from sibling tools. For a simple read operation, this is adequate but not fully comprehensive, especially without annotations to fill in gaps.

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?

The input schema has 100% description coverage, with the single parameter 'endpoint' clearly documented as 'The name of the endpoint to get the schema for.' The description doesn't add any additional semantic information about this parameter beyond what the schema provides (e.g., examples of endpoint names, format constraints). According to the rules, when schema_description_coverage is high (>80%), the baseline score is 3 even with no param info in the description, which applies here.

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 verb ('Get') and resource ('schema for an endpoint in the HIVE API'), making the purpose specific and understandable. However, it doesn't explicitly differentiate this tool from its many siblings (like get_defi_protocol_endpoints, get_token_contract_endpoints, etc.), which all seem to retrieve endpoint-related schemas but for different categories. A perfect score would require clarifying how this general endpoint schema tool differs from those category-specific ones.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'You can use the schema returned by this tool to call an endpoint with the `call_api_endpoint` tool.' This directly states the tool's purpose in the workflow and names the alternative/complementary tool (call_api_endpoint), giving clear context for usage without any misleading information.

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

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