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 } }; } }

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