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
| Name | Required | Description | Default |
|---|---|---|---|
| section | Yes | Documentation section to fetch (e.g., "developing", "running-validator", "economics") |
Implementation Reference
- src/index.ts:155-191 (handler)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, }; } }
- src/index.ts:33-46 (schema)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'], }, },
- src/index.ts:36-46 (schema)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'], }, },