Skip to main content
Glama
elias-michaias

Onyx Documentation MCP Server

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
NameRequiredDescriptionDefault
directoryNoDirectory containing the Onyx package (defaults to current working directory).
timeoutNoBuild timeout in seconds

Implementation Reference

  • 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);
      }
    }
  • 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 }
          }
        }
      },
    ];
  • Dispatcher switch case that routes calls to the onyx_pkg_build handler.
    case 'onyx_pkg_build':
      return await this.onyxPkgBuild(args.directory, args.timeout);

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