Skip to main content
Glama
elias-michaias

Onyx Documentation MCP Server

search_onyx_docs

Search official Onyx programming language documentation to find answers and code examples for development questions.

Instructions

Search official Onyx programming language documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for documentation
limitNoMaximum number of results

Implementation Reference

  • The primary handler function for the 'search_onyx_docs' tool. It invokes the SearchEngine to perform the documentation search and formats the response with global context and tool-specific message.
    async searchOnyxDocs(query, limit = 5) { const results = await this.searchEngine.searchDocs(query, limit); const toolMessage = `Searching official Onyx documentation for: "${query}"`; return this.formatResponse(JSON.stringify(results, null, 2), toolMessage); }
  • The input schema definition for the 'search_onyx_docs' tool, including name, description, parameters (query required, limit optional), as part of TOOL_DEFINITIONS array.
    name: 'search_onyx_docs', description: 'Search official Onyx programming language documentation', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for documentation' }, limit: { type: 'number', description: 'Maximum number of results', default: 5 } }, required: ['query'] } },
  • Tool registration in the executeTool dispatcher switch statement, mapping the tool name to its handler function.
    case 'search_onyx_docs': return await this.searchOnyxDocs(args.query, args.limit);
  • Core search logic helper in SearchEngine class. Loads documentation data from JSON, performs fuzzy search on titles, content, and headings with scoring, sorts results by score, and returns formatted matches.
    async searchDocs(query, limit = 5) { const docs = await this.loadData('docs'); if (!docs) { return { error: 'Documentation not available. Run crawler first.' }; } const queryLower = query.toLowerCase(); const results = []; for (const doc of docs) { let score = 0; const titleMatch = doc.title.toLowerCase().includes(queryLower); const contentMatch = doc.content.toLowerCase().includes(queryLower); if (titleMatch) score += 10; if (contentMatch) score += 1; // Check headings for (const heading of doc.headings || []) { if (heading.text.toLowerCase().includes(queryLower)) { score += 5; } } if (score > 0) { results.push({ ...doc, score, snippet: this.getSnippet(doc.content, queryLower) }); } } results.sort((a, b) => b.score - a.score); return { query, source: 'documentation', totalFound: results.length, results: results.slice(0, limit).map(r => ({ title: r.title, url: r.url, snippet: r.snippet, headings: (r.headings || []).map(h => h.text).slice(0, 3), score: r.score })) }; }

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