onyx_pkg_build
Build Onyx packages using the onyx pkg build command in a specified directory with configurable timeout settings.
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 given directory, handles timeouts, captures output, and formats the MCP response.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:161-172 (schema)Tool definition including name, description, and input schema for parameter validation.{ 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)Dispatcher switch case that routes calls to the onyx_pkg_build handler.case 'onyx_pkg_build': return await this.onyxPkgBuild(args.directory, args.timeout);