Skip to main content
Glama

get_api_reference

Retrieve detailed API reference documentation for Solana SDK, including specific items like transactions, pubkeys, and system instructions, to aid in blockchain development and integration.

Instructions

Get Solana SDK API reference details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemYesAPI item to look up (e.g., "transaction", "pubkey", "system_instruction")

Implementation Reference

  • The handler function that implements the 'get_api_reference' tool logic. Validates the 'item' parameter, scrapes the Solana SDK API reference from docs.rs using axios and cheerio, extracts documentation and signature, and returns structured content or error.
    private async handleGetApiReference(args: any) { if (!args.item || typeof args.item !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid item parameter'); } try { const response = await axios.get(`${this.apiDocsUrl}/${args.item.toLowerCase()}`); const $ = cheerio.load(response.data); // Extract API documentation const docContent = $('.docblock').first().text(); const signature = $('.rust.fn, .rust.struct, .rust.trait').first().text(); return { content: [ { type: 'text', text: JSON.stringify({ item: args.item, signature, documentation: docContent, url: `${this.apiDocsUrl}/${args.item.toLowerCase()}`, timestamp: new Date().toISOString(), }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching API reference: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
  • Primary schema definition for the 'get_api_reference' tool in the server's capabilities declaration, specifying name, description, and input schema.
    get_api_reference: { name: 'get_api_reference', description: 'Get Solana SDK API reference details', inputSchema: { type: 'object', properties: { item: { type: 'string', description: 'API item to look up (e.g., "transaction", "pubkey", "system_instruction")', }, }, required: ['item'], }, }
  • src/index.ts:138-152 (registration)
    Registration of the tool dispatcher in setupToolHandlers. The switch statement routes 'get_api_reference' calls to its handler function.
    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}` ); } });
  • Duplicate schema for 'get_api_reference' returned in the ListToolsRequestSchema handler.
    { name: 'get_api_reference', description: 'Get Solana SDK API reference details', inputSchema: { type: 'object', properties: { item: { type: 'string', description: 'API item to look up (e.g., "transaction", "pubkey", "system_instruction")', }, }, required: ['item'], }, },

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