Skip to main content
Glama
aldrin-labs

solana-docs-mcp-server

by aldrin-labs

search_docs

Search Solana documentation for specific queries using the solana-docs-mcp-server. Quickly find relevant information with a structured search tool.

Instructions

Search through Solana documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • The primary handler function implementing the logic for the 'search_docs' tool. It validates input, crawls Solana docs navigation, searches page contents using cheerio, collects matching sections, and returns JSON-formatted results.
    private async handleSearchDocs(args: any) {
      if (!args.query || typeof args.query !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid query parameter');
      }
    
      try {
        // First get the main page to extract sections
        const mainResponse = await axios.get(this.baseDocsUrl);
        const $ = cheerio.load(mainResponse.data);
        
        const searchResults: DocSection[] = [];
        
        // Search through main navigation items
        const navItems = $('.sidebar-nav').find('a');
        const searchPromises = navItems.map(async (_, el) => {
          const href = $(el).attr('href');
          if (href && !href.startsWith('http')) {
            try {
              const pageResponse = await axios.get(`${this.baseDocsUrl}${href}`);
              const page$ = cheerio.load(pageResponse.data);
              const content = page$('.markdown-section').text();
              
              if (content.toLowerCase().includes(args.query.toLowerCase())) {
                searchResults.push({
                  title: page$('h1').first().text() || $(el).text(),
                  content: content.substring(0, 200) + '...',  // Preview
                  url: `${this.baseDocsUrl}${href}`,
                });
              }
            } catch (error) {
              console.error(`Error searching page ${href}:`, error);
            }
          }
        }).get();
    
        await Promise.all(searchPromises);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                query: args.query,
                results: searchResults,
                timestamp: new Date().toISOString(),
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error searching docs: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Tool schema definition in server capabilities, including name, description, and input schema requiring a 'query' string.
    search_docs: {
      name: 'search_docs',
      description: 'Search through Solana documentation',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query',
          },
        },
        required: ['query'],
      },
    },
  • src/index.ts:107-120 (registration)
    Registration of 'search_docs' tool in the ListTools response handler, providing schema for tool discovery.
    {
      name: 'search_docs',
      description: 'Search through Solana documentation',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query',
          },
        },
        required: ['query'],
      },
    },
  • src/index.ts:142-143 (registration)
    Dispatch case in CallToolRequest handler routing 'search_docs' calls to the handleSearchDocs method.
    case 'search_docs':
      return await this.handleSearchDocs(request.params.arguments);
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It doesn't disclose whether this is a read-only operation, how results are returned (e.g., pagination, sorting), performance characteristics, or any limitations (e.g., rate limits, authentication needs). The description only states what it does at a high level without operational details.

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

Conciseness4/5

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

The description is a single, efficient sentence with no wasted words. It's appropriately sized for a simple tool, though it could be more front-loaded with key details. The brevity is good, but it borders on under-specification given the lack of additional context.

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?

For a search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., list of documents, snippets, links), how results are structured, or any error conditions. The agent is left without enough information to understand the full behavior and output of the tool.

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?

The input schema has 100% description coverage, with the single parameter 'query' documented as 'Search query'. The description adds no additional meaning beyond this, such as query syntax examples, supported operators, or character limits. Given high schema coverage, the baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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

Purpose3/5

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

The description 'Search through Solana documentation' states a clear action (search) and resource (Solana documentation), but it's vague about scope and doesn't differentiate from sibling tools like 'get_api_reference' or 'get_latest_docs'. It doesn't specify what kind of search this is (full-text, keyword, etc.) or what content it searches.

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?

No guidance is provided on when to use this tool versus the sibling tools 'get_api_reference' or 'get_latest_docs'. The description doesn't indicate whether this is for general documentation search versus more specific reference or latest updates, leaving the agent to guess about appropriate contexts.

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