Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

add_endpoint

Configure new API endpoints to extend Grove's Pocket Network server capabilities for accessing blockchain data across multiple networks.

Instructions

Dynamically add a new endpoint configuration (for extensibility)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUnique identifier for the endpoint
nameYesHuman-readable name
pathYesURL path (e.g., "/api/users/:id")
methodYesHTTP method
descriptionYesDescription of what the endpoint does
categoryYesCategory for organization

Implementation Reference

  • The handler logic for the 'add_endpoint' tool within the handleEndpointTool function. It calls endpointManager.addEndpoint with the provided arguments and returns a success or error response.
    case 'add_endpoint': {
      const endpoint = args as any;
    
      try {
        endpointManager.addEndpoint(endpoint);
    
        return {
          content: [
            {
              type: 'text',
              text: `Successfully added endpoint: ${endpoint.id}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: error instanceof Error ? error.message : 'Failed to add endpoint',
            },
          ],
          isError: true,
        };
      }
    }
  • Registration of the 'add_endpoint' tool in the tools array returned by registerEndpointHandlers, including name, description, and input schema.
    {
      name: 'add_endpoint',
      description: 'Dynamically add a new endpoint configuration (for extensibility)',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'Unique identifier for the endpoint',
          },
          name: {
            type: 'string',
            description: 'Human-readable name',
          },
          path: {
            type: 'string',
            description: 'URL path (e.g., "/api/users/:id")',
          },
          method: {
            type: 'string',
            enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
            description: 'HTTP method',
          },
          description: {
            type: 'string',
            description: 'Description of what the endpoint does',
          },
          category: {
            type: 'string',
            description: 'Category for organization',
          },
        },
        required: ['id', 'name', 'path', 'method', 'description', 'category'],
      },
    },
  • The core helper method addEndpoint in EndpointManager class that actually adds the new endpoint to the config, checks for duplicates, and updates categories.
    addEndpoint(endpoint: EndpointConfig): void {
      // Check if endpoint already exists
      if (this.config.endpoints.find(ep => ep.id === endpoint.id)) {
        throw new Error(`Endpoint with ID ${endpoint.id} already exists`);
      }
    
      // Add category if it doesn't exist
      if (!this.config.categories.includes(endpoint.category)) {
        this.config.categories.push(endpoint.category);
      }
    
      this.config.endpoints.push(endpoint);
    }

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