Skip to main content
Glama

run_build

Execute build commands in a specified directory using package managers like npm, yarn, or pnpm. Simplifies development workflows by automating build processes with error reporting for efficient debugging.

Instructions

Run build command in the current directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandNoBuild command to run (e.g., "npm run build", "yarn build")npm run build
directoryNoDirectory to run the build in (default: current directory)

Implementation Reference

  • The handler function that implements the 'run_build' tool logic. It runs the specified build command (default: 'npm run build') in the given directory using execSync and returns the output or throws an error.
    private async runBuild(args: any) { const command = args?.command || 'npm run build'; const directory = args?.directory || process.cwd(); try { const output = execSync(command, { cwd: directory, encoding: 'utf8', timeout: 300000 // 5 minutes }); return { content: [ { type: 'text', text: `Build successful!\nCommand: ${command}\nDirectory: ${directory}\nOutput:\n${output}` } ] }; } catch (error: any) { throw new Error(`Build failed: ${error.message}\nStderr: ${error.stderr || 'N/A'}`); } }
  • The schema definition for the 'run_build' tool, including name, description, and input schema with optional command and directory parameters.
    { name: 'run_build', description: 'Run build command in the current directory', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'Build command to run (e.g., "npm run build", "yarn build")', default: 'npm run build' }, directory: { type: 'string', description: 'Directory to run the build in (default: current directory)' } } } },
  • src/index.ts:139-140 (registration)
    Registration of the 'run_build' tool handler in the switch statement within the CallToolRequestSchema request handler.
    case 'run_build': return await this.runBuild(args);

Other Tools

Related Tools

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/TeodorTrotea/mcptest'

If you have feedback or need assistance with the MCP directory API, please join our Discord server