Skip to main content
Glama
aldrin-labs

solana-docs-mcp-server

by aldrin-labs

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'],
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'gets' details, implying a read-only operation, but doesn't cover aspects like rate limits, authentication needs, error handling, or what format the details are returned in. This leaves significant gaps for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—it directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that fetches API details. It doesn't explain what 'details' include (e.g., methods, properties, examples), how results are structured, or any behavioral traits like caching or errors. This leaves the agent under-informed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'item' well-documented in the schema as 'API item to look up' with examples. The description adds no additional meaning beyond this, such as clarifying the scope of 'API reference details' or how items are categorized. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('Solana SDK API reference details'), making the purpose understandable. However, it doesn't differentiate this tool from its siblings (get_latest_docs, search_docs), which appear related to documentation but have different functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings (get_latest_docs, search_docs). It implies usage for looking up API details but offers no context on alternatives or exclusions, leaving the agent to guess based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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