Skip to main content
Glama
aldrin-labs

solana-docs-mcp-server

by aldrin-labs

get_latest_docs

Retrieve specific Solana documentation sections such as "developing" or "running-validator" to access targeted technical content for development or validation tasks.

Instructions

Get latest Solana documentation sections

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sectionYesDocumentation section to fetch (e.g., "developing", "running-validator", "economics")

Implementation Reference

  • The main handler function for the 'get_latest_docs' tool. It validates the 'section' input, fetches the Solana docs page using axios, parses HTML with cheerio to extract title and content, truncates content, and returns a structured response or error.
    private async handleGetLatestDocs(args: any) {
      if (!args.section || typeof args.section !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid section parameter');
      }
    
      try {
        const response = await axios.get(`${this.baseDocsUrl}/${args.section}`);
        const $ = cheerio.load(response.data);
        
        const content = $('.markdown-section').text();
        const title = $('h1').first().text();
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                title,
                content: content.substring(0, 1000) + '...',  // Truncate for readability
                url: `${this.baseDocsUrl}/${args.section}`,
                timestamp: new Date().toISOString(),
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching docs: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the 'get_latest_docs' tool in the MCP server capabilities, specifying the required 'section' parameter.
    get_latest_docs: {
      name: 'get_latest_docs',
      description: 'Get latest Solana documentation sections',
      inputSchema: {
        type: 'object',
        properties: {
          section: {
            type: 'string',
            description: 'Documentation section to fetch (e.g., "developing", "running-validator", "economics")',
          },
        },
        required: ['section'],
      },
    },
  • src/index.ts:138-152 (registration)
    Registration of the tool handler via the CallToolRequestSchema dispatcher switch, which routes 'get_latest_docs' calls to handleGetLatestDocs.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      switch (request.params.name) {
        case 'get_latest_docs':
          return await this.handleGetLatestDocs(request.params.arguments);
        case 'search_docs':
          return await this.handleSearchDocs(request.params.arguments);
        case 'get_api_reference':
          return await this.handleGetApiReference(request.params.arguments);
        default:
          throw new McpError(
            ErrorCode.MethodNotFound,
            `Unknown tool: ${request.params.name}`
          );
      }
    });
  • src/index.ts:94-106 (registration)
    Tool metadata including schema returned by ListToolsRequestHandler.
      name: 'get_latest_docs',
      description: 'Get latest Solana documentation sections',
      inputSchema: {
        type: 'object',
        properties: {
          section: {
            type: 'string',
            description: 'Documentation section to fetch (e.g., "developing", "running-validator", "economics")',
          },
        },
        required: ['section'],
      },
    },
  • Core input schema for validating arguments to get_latest_docs.
      inputSchema: {
        type: 'object',
        properties: {
          section: {
            type: 'string',
            description: 'Documentation section to fetch (e.g., "developing", "running-validator", "economics")',
          },
        },
        required: ['section'],
      },
    },

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related 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/aldrin-labs/solana-docs-mcp-server'

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