get_onyx_functions
Retrieve Onyx programming language function definitions and code examples from GitHub documentation to support development tasks.
Instructions
Get Onyx function definitions and examples from GitHub
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| functionName | No | Function name to search for (optional) | |
| limit | No | Maximum number of examples |
Implementation Reference
- src/core/mcp-shared.js:211-217 (handler)The main handler method for the 'get_onyx_functions' tool. It calls the search engine helper and formats the MCP response with context.async getOnyxFunctions(functionName, limit = 10) { const results = await this.searchEngine.getOnyxFunctionExamples(functionName, limit); const toolMessage = functionName ? `Searching for Onyx function examples: "${functionName}"` : 'Searching for all available Onyx function examples'; return this.formatResponse(JSON.stringify(results, null, 2), toolMessage); }
- src/core/mcp-shared.js:67-77 (schema)Input schema definition for the 'get_onyx_functions' tool within the TOOL_DEFINITIONS array.{ name: 'get_onyx_functions', description: 'Get Onyx function definitions and examples from GitHub', inputSchema: { type: 'object', properties: { functionName: { type: 'string', description: 'Function name to search for (optional)' }, limit: { type: 'number', description: 'Maximum number of examples', default: 10 } } } },
- src/core/mcp-shared.js:631-632 (registration)Tool registration in the executeTool dispatcher switch statement, routing calls to the handler.case 'get_onyx_functions': return await this.getOnyxFunctions(args.functionName, args.limit);
- src/core/search-engine.js:136-161 (helper)Helper method implementing the core logic: loads GitHub code patterns and filters/returns Onyx function examples.async getOnyxFunctionExamples(functionName = null, limit = 10) { const patterns = await this.loadData('githubPatterns'); if (!patterns) { return { error: 'GitHub patterns not available. Run GitHub crawler first.' }; } let functions = patterns.functions || []; if (functionName) { // Filter by function name (partial match) functions = functions.filter(func => func.definition.toLowerCase().includes(functionName.toLowerCase()) ); } return { query: functionName, totalFound: functions.length, examples: functions.slice(0, limit).map(func => ({ definition: func.definition, file: func.file, repository: func.repository, url: func.url })) }; }