Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

call_endpoint

Call blockchain endpoints across 70+ networks to access token analytics, transaction data, domain resolution, and multi-chain comparisons using Grove's Pocket Network infrastructure.

Instructions

Call a Pocket Network endpoint with optional parameters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointIdYesThe ID of the endpoint to call
pathParamsNoPath parameters (e.g., {id: "123"} for /users/:id)
queryParamsNoQuery parameters to append to the URL
bodyNoRequest body for POST/PUT/PATCH requests

Implementation Reference

  • MCP tool handler logic for 'call_endpoint': extracts parameters and calls EndpointManager.fetchEndpoint to execute the request.
    case 'call_endpoint': {
      const endpointId = args?.endpointId as string;
      const pathParams = args?.pathParams as Record<string, string> | undefined;
      const queryParams = args?.queryParams as Record<string, string> | undefined;
      const body = args?.body as any;
    
      const result = await endpointManager.fetchEndpoint(endpointId, {
        pathParams,
        queryParams,
        body,
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
        isError: !result.success,
      };
    }
  • Input schema definition for the 'call_endpoint' tool, specifying parameters like endpointId, pathParams, queryParams, and body.
    {
      name: 'call_endpoint',
      description: "Call a Pocket Network endpoint with optional parameters",
      inputSchema: {
        type: 'object',
        properties: {
          endpointId: {
            type: 'string',
            description: 'The ID of the endpoint to call',
          },
          pathParams: {
            type: 'object',
            description: 'Path parameters (e.g., {id: "123"} for /users/:id)',
          },
          queryParams: {
            type: 'object',
            description: 'Query parameters to append to the URL',
          },
          body: {
            type: 'object',
            description: 'Request body for POST/PUT/PATCH requests',
          },
        },
        required: ['endpointId'],
      },
    },
  • src/index.ts:88-101 (registration)
    Registration of endpoint tools (including 'call_endpoint') by calling registerEndpointHandlers and adding to the tools list used in ListToolsRequestHandler.
    const tools: Tool[] = [
      ...registerBlockchainHandlers(server, blockchainService),
      ...registerDomainHandlers(server, domainResolver),
      ...registerTransactionHandlers(server, advancedBlockchain),
      ...registerTokenHandlers(server, advancedBlockchain),
      ...registerMultichainHandlers(server, advancedBlockchain),
      ...registerContractHandlers(server, advancedBlockchain),
      ...registerUtilityHandlers(server, advancedBlockchain),
      ...registerEndpointHandlers(server, endpointManager),
      ...registerSolanaHandlers(server, solanaService),
      ...registerCosmosHandlers(server, cosmosService),
      ...registerSuiHandlers(server, suiService),
      ...registerDocsHandlers(server, docsManager),
    ];
  • Core helper function implementing the HTTP request logic: builds URL, handles params/body, performs fetch, and returns structured response.
    async fetchEndpoint(
      endpointId: string,
      options?: {
        pathParams?: Record<string, string>;
        queryParams?: Record<string, string>;
        body?: any;
      }
    ): Promise<EndpointResponse> {
      const endpoint = this.getEndpointById(endpointId);
      if (!endpoint) {
        return {
          success: false,
          error: `Endpoint not found: ${endpointId}`
        };
      }
    
      try {
        const url = new URL(this.buildEndpointUrl(endpointId, options?.pathParams));
    
        // Add query parameters
        if (options?.queryParams) {
          Object.entries(options.queryParams).forEach(([key, value]) => {
            url.searchParams.append(key, value);
          });
        }
    
        const fetchOptions: RequestInit = {
          method: endpoint.method,
          headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json'
          }
        };
    
        if (options?.body && endpoint.method !== 'GET') {
          fetchOptions.body = JSON.stringify(options.body);
        }
    
        const response = await fetch(url.toString(), fetchOptions);
        const data = await response.json();
    
        return {
          success: response.ok,
          data: response.ok ? data : undefined,
          error: response.ok ? undefined : data.message || `HTTP ${response.status}`,
          metadata: {
            timestamp: new Date().toISOString(),
            endpoint: url.toString()
          }
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error',
          metadata: {
            timestamp: new Date().toISOString(),
            endpoint: endpointId
          }
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'optional parameters' but doesn't explain key behaviors like required authentication, rate limits, error handling, or what the call does (e.g., executes HTTP requests, returns data). For a tool that likely interacts with external networks, this omission is significant and leaves the agent without crucial operational context.

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 extremely concise—a single sentence that directly states the tool's function. It's front-loaded with the core action and resource, with no wasted words. This efficiency makes it easy to parse, though it sacrifices detail for brevity, which impacts other dimensions like guidelines and transparency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of calling network endpoints with multiple parameters, no annotations, and no output schema, the description is incomplete. It lacks information on authentication, error cases, response formats, and when to use versus siblings. For a tool that likely involves network I/O and mutation (e.g., via body parameter), more context is needed to ensure safe and effective use by 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 input schema fully documents the four parameters (endpointId, pathParams, queryParams, body). The description adds minimal value by noting 'optional parameters,' but doesn't elaborate on their usage or relationships beyond what the schema provides. This meets the baseline for high schema coverage, though it could enhance understanding with examples or constraints.

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 action ('Call') and resource ('a Pocket Network endpoint'), making the purpose understandable. It distinguishes from siblings like 'get_endpoint_details' or 'list_endpoints' by focusing on execution rather than retrieval. However, it doesn't specify what types of endpoints (e.g., HTTP methods) or the network context, leaving some ambiguity compared to more precise alternatives.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools for specific operations (e.g., 'get_block_details', 'call_contract_view'), it fails to indicate scenarios where this generic endpoint call is preferred, such as for custom or unsupported endpoints. This lack of context makes it challenging for an agent to select appropriately among similar 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/buildwithgrove/mcp-pocket'

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