Skip to main content
Glama
elias-michaias

Onyx Documentation MCP Server

search_github_examples

Find Onyx programming code examples on GitHub by topic to help developers learn from real implementations.

Instructions

Search Onyx code examples from GitHub repositories by topic

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYesTopic to search for
limitNoMaximum number of examples

Implementation Reference

  • Core handler implementation: Searches pre-crawled GitHub Onyx code examples organized by topic from 'github/examples-by-topic.json'. Matches topics fuzzily and returns relevant code snippets.
    async searchGitHubExamples(topic, limit = 5) {
      const examplesByTopic = await this.loadData('examplesByTopic');
      if (!examplesByTopic) {
        return { error: 'GitHub examples not available. Run GitHub crawler first.' };
      }
    
      const availableTopics = Object.keys(examplesByTopic);
      
      // Find matching topics (exact match or contains)
      const matchingTopics = availableTopics.filter(t => 
        t.toLowerCase().includes(topic.toLowerCase()) ||
        topic.toLowerCase().includes(t.toLowerCase())
      );
    
      if (matchingTopics.length === 0) {
        return {
          query: topic,
          availableTopics: availableTopics.sort(),
          examples: [],
          message: `No examples found for topic "${topic}". Try one of the available topics.`
        };
      }
    
      const examples = [];
      for (const matchingTopic of matchingTopics) {
        const topicExamples = examplesByTopic[matchingTopic] || [];
        examples.push(...topicExamples.slice(0, Math.ceil(limit / matchingTopics.length)));
      }
    
      return {
        query: topic,
        matchingTopics,
        examples: examples.slice(0, limit).map(example => ({
          file: example.path,
          repository: example.repository,
          url: example.url,
          code: example.code.length > 1000 ? 
            example.code.substring(0, 1000) + '\n... (truncated)' : 
            example.code,
          fullCodeLength: example.code.length
        })),
        totalAvailable: examples.length,
        availableTopics: availableTopics.sort()
      };
    }
  • Tool registration in TOOL_DEFINITIONS array, including name, description, and input schema for MCP integration.
    {
      name: 'search_github_examples',
      description: 'Search Onyx code examples from GitHub repositories by topic',
      inputSchema: {
        type: 'object',
        properties: {
          topic: { type: 'string', description: 'Topic to search for' },
          limit: { type: 'number', description: 'Maximum number of examples', default: 5 }
        },
        required: ['topic']
      }
    },
  • MCP wrapper handler: Delegates to SearchEngine, adds tool-specific message, and formats response with global context.
    async searchGitHubExamples(topic, limit = 5) {
      const results = await this.searchEngine.searchGitHubExamples(topic, limit);
      const toolMessage = `Searching GitHub repositories for Onyx code examples related to: "${topic}"`;
      return this.formatResponse(JSON.stringify(results, null, 2), toolMessage);
    }
  • Dispatcher switch case in executeTool method that invokes the tool wrapper handler.
    case 'search_github_examples':
      return await this.searchGitHubExamples(args.topic, args.limit);
  • JSON schema defining input parameters: topic (required string), limit (optional number, default 5).
    inputSchema: {
      type: 'object',
      properties: {
        topic: { type: 'string', description: 'Topic to search for' },
        limit: { type: 'number', description: 'Maximum number of examples', default: 5 }
      },
      required: ['topic']
    }
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. While it states the search action, it doesn't describe what the tool returns (e.g., format, structure), whether it performs real-time queries or uses cached data, or any limitations like rate limits or authentication requirements for GitHub access.

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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the core functionality and appropriately sized for a simple search tool.

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 the lack of annotations and output schema, the description is incomplete. It doesn't explain what the search results look like (e.g., list of examples with metadata), how results are sorted or filtered, or any behavioral nuances. For a search tool with no structured output documentation, this leaves significant gaps for an AI agent.

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, clearly documenting both parameters ('topic' and 'limit') with their types and purposes. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline of 3 for adequate schema coverage.

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 ('Search') and target ('Onyx code examples from GitHub repositories by topic'), making the purpose understandable. However, it doesn't differentiate this tool from sibling tools like 'search_all_sources' or 'search_onyx_docs', which appear to have overlapping search functionality but different targets.

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 alternatives. With sibling tools like 'search_all_sources' and 'search_onyx_docs' available, there's no indication of what makes this tool distinct or when it should be preferred over those options.

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

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/elias-michaias/onyx_mcp'

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