Skip to main content
Glama
elias-michaias

Onyx Documentation MCP Server

get_onyx_structs

Retrieve Onyx struct definitions and practical examples directly from GitHub, enabling developers to explore and implement structs with ease. Specify struct names or set limits for precise results.

Instructions

Get Onyx struct definitions and examples from GitHub

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of examples
structNameNoStruct name to search for (optional)

Implementation Reference

  • Core handler logic for retrieving Onyx struct examples from pre-crawled GitHub patterns data, filtering by structName if provided, and formatting results.
    async getOnyxStructExamples(structName = null, limit = 10) { const patterns = await this.loadData('githubPatterns'); if (!patterns) { return { error: 'GitHub patterns not available. Run GitHub crawler first.' }; } let structs = patterns.structs || []; if (structName) { // Filter by struct name (partial match) structs = structs.filter(struct => struct.definition.toLowerCase().includes(structName.toLowerCase()) ); } return { query: structName, totalFound: structs.length, examples: structs.slice(0, limit).map(struct => ({ definition: struct.definition, file: struct.file, repository: struct.repository, url: struct.url })) }; }
  • MCP tool handler for 'get_onyx_structs' that delegates to SearchEngine, generates tool-specific message, and formats the MCP response.
    async getOnyxStructs(structName, limit = 10) { const results = await this.searchEngine.getOnyxStructExamples(structName, limit); const toolMessage = structName ? `Searching for Onyx struct definitions: "${structName}"` : 'Searching for all available Onyx struct definitions'; return this.formatResponse(JSON.stringify(results, null, 2), toolMessage); }
  • Tool schema definition specifying input parameters: optional structName (string) and limit (number, default 10). Used for validation and documentation.
    { name: 'get_onyx_structs', description: 'Get Onyx struct definitions and examples from GitHub', inputSchema: { type: 'object', properties: { structName: { type: 'string', description: 'Struct name to search for (optional)' }, limit: { type: 'number', description: 'Maximum number of examples', default: 10 } } } },
  • Registers all tools (including get_onyx_structs via TOOL_DEFINITIONS) for MCP listTools request.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TOOL_DEFINITIONS }; });
  • Dispatcher switch case that routes 'get_onyx_structs' tool calls to the handler method.
    case 'get_onyx_structs': return await this.getOnyxStructs(args.structName, args.limit);

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