onyx_pkg_build
Generate an Onyx package by specifying a directory and timeout, streamlining package creation for Onyx programming projects.
Instructions
Build an Onyx package using "onyx pkg build" in a specified directory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| directory | No | Directory containing the Onyx package (defaults to current working directory) | . |
| timeout | No | Build timeout in seconds |
Implementation Reference
- src/core/mcp-shared.js:428-468 (handler)The handler function that executes the 'onyx pkg build' command in the specified directory. It resolves the directory, checks existence, runs the command with timeout handling using executeOnyxCommand, and formats the MCP response with results or errors.async onyxPkgBuild(directory = '.', timeout = 60) { const toolMessage = `Building Onyx package using "onyx pkg build" in directory: ${directory}`; try { // Resolve the target directory const targetDir = path.resolve(directory); // Check if directory exists try { await fs.access(targetDir); } catch (error) { throw new Error(`Directory does not exist: ${targetDir}`); } // Build the Onyx package in target directory const result = await this.executeOnyxCommand(['pkg', 'build'], timeout, targetDir); // Format the response with build results const response = { success: result.success, exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr, executionTime: result.executionTime, command: 'onyx pkg build', workingDirectory: targetDir }; return this.formatResponse(JSON.stringify(response, null, 2), toolMessage); } catch (error) { const errorResponse = { success: false, error: error.message, command: 'onyx pkg build', workingDirectory: directory }; return this.formatResponse(JSON.stringify(errorResponse, null, 2), toolMessage); } }
- src/core/mcp-shared.js:164-170 (schema)Input schema for the onyx_pkg_build tool, defining directory (string, default '.') and timeout (number, default 60) parameters.inputSchema: { type: 'object', properties: { directory: { type: 'string', description: 'Directory containing the Onyx package (defaults to current working directory)', default: '.' }, timeout: { type: 'number', description: 'Build timeout in seconds', default: 60 } } }
- src/core/mcp-shared.js:161-171 (registration)Registration of the onyx_pkg_build tool in the TOOL_DEFINITIONS array, including name, description, and input schema.{ name: 'onyx_pkg_build', description: 'Build an Onyx package using "onyx pkg build" in a specified directory', inputSchema: { type: 'object', properties: { directory: { type: 'string', description: 'Directory containing the Onyx package (defaults to current working directory)', default: '.' }, timeout: { type: 'number', description: 'Build timeout in seconds', default: 60 } } } },
- src/core/mcp-shared.js:654-655 (registration)Dispatch registration in the executeTool switch statement that maps the tool name to the onyxPkgBuild handler.case 'onyx_pkg_build': return await this.onyxPkgBuild(args.directory, args.timeout);