Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_doc_page

Retrieve documentation pages from Pocket Network's API documentation to access blockchain data specifications and integration guides.

Instructions

Retrieve a documentation page from api.pocket.network/docs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe path to the documentation page (e.g., "/api/overview")

Implementation Reference

  • Executes the get_doc_page tool by calling docsManager.getDocPage and formatting the response as MCP content.
    case 'get_doc_page': {
      const path = args?.path as string;
      const docPage = await docsManager.getDocPage(path);
    
      if (!docPage) {
        return {
          content: [
            {
              type: 'text',
              text: `Documentation page not found: ${path}`,
            },
          ],
          isError: true,
        };
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(docPage, null, 2),
          },
        ],
      };
    }
  • Defines the input schema for the get_doc_page tool, requiring a 'path' string.
    inputSchema: {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: 'The path to the documentation page (e.g., "/api/overview")',
        },
      },
      required: ['path'],
    },
  • Registers the get_doc_page tool in the tools array returned by registerDocsHandlers.
    {
      name: 'get_doc_page',
      description: 'Retrieve a documentation page from api.pocket.network/docs',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'The path to the documentation page (e.g., "/api/overview")',
          },
        },
        required: ['path'],
      },
    },
  • Core implementation of fetching a documentation page from the configured base URL, extracting title, and returning DocPage.
    async getDocPage(path: string): Promise<DocPage | null> {
      try {
        const url = `${this.baseUrl}${path.startsWith('/') ? path : '/' + path}`;
        const response = await fetch(url);
    
        if (!response.ok) {
          return null;
        }
    
        const content = await response.text();
    
        return {
          title: this.extractTitle(content),
          content,
          url,
          lastUpdated: response.headers.get('last-modified') || undefined
        };
      } catch (error) {
        console.error('Error fetching doc page:', error);
        return null;
      }
    }

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