get_onyx_structs
Retrieve struct definitions and code examples for the Onyx programming language from GitHub documentation to understand data structures and implementation patterns.
Instructions
Get Onyx struct definitions and examples from GitHub
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| structName | No | Struct name to search for (optional) | |
| limit | No | Maximum number of examples |
Implementation Reference
- src/core/mcp-shared.js:219-225 (handler)Primary handler for get_onyx_structs tool: delegates to SearchEngine for examples and formats MCP response with context.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); }
- src/core/search-engine.js:164-189 (helper)Core helper logic: loads githubPatterns data, filters Onyx struct definitions by optional structName, limits results, and formats output.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 })) }; }
- src/core/mcp-shared.js:78-88 (schema)Tool definition with name, description, and input schema (structName: optional string, limit: optional number default 10). Used for MCP tool listing.{ 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 } } } },
- src/mcp-server.js:35-48 (registration)MCP server setup where TOOL_DEFINITIONS provides schemas for list tools request, and tool calls are routed to SharedMcpImplementation.executeTool.setupHandlers() { // List all available tools this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TOOL_DEFINITIONS }; }); // Handle tool calls this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; return await this.mcpImpl.executeTool(name, args); }); }
- src/core/mcp-shared.js:634-635 (registration)Specific dispatcher case in executeTool method that invokes the getOnyxStructs handler for this tool.case 'get_onyx_structs': return await this.getOnyxStructs(args.structName, args.limit);