make
Execute make commands in isolated build environments to compile code, run tests, and manage software builds without local dependencies.
Instructions
Run make command with specified arguments. Executes make in the root of the specified repository. If branch is specified, creates/uses a hidden worktree (.repo@branch) for isolation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Arguments to pass to make (e.g., 'clean', 'all', 'test') | |
| repo | Yes | Repository name (required) | |
| branch | No | Git branch name (optional). If provided, uses isolated worktree. |
Implementation Reference
- src/server.py:484-501 (handler)The main handler function for the 'make' tool. Extracts repo, branch, and args from input, validates args, builds the make command, executes it in the repository's worktree (handling git worktrees for branches), and returns the formatted output.async def handle_make(self, args: Dict[str, Any]) -> List[TextContent]: """Handle make command""" repo = args.get("repo") branch = args.get("branch") make_args = args.get("args", "") # Validate arguments validate_make_args(make_args) # Build command cmd = ["make"] if make_args: cmd.extend(shlex.split(make_args)) # Execute in appropriate worktree with locking result = await self.execute_in_worktree(repo, branch, cmd) return [TextContent(type="text", text=result)]
- src/server.py:325-347 (registration)Registers the 'make' tool with the MCP server in list_tools handler. Defines the tool name, description, and input schema (JSON schema).name="make", description="Run make command with specified arguments. " "Executes make in the root of the specified repository. " "If branch is specified, creates/uses a hidden worktree (.repo@branch) for isolation.", inputSchema={ "type": "object", "properties": { "args": { "type": "string", "description": "Arguments to pass to make (e.g., 'clean', 'all', 'test')" }, "repo": { "type": "string", "description": "Repository name (required)" }, "branch": { "type": "string", "description": "Git branch name (optional). If provided, uses isolated worktree." } }, "required": ["repo"] } ),
- src/server.py:329-347 (schema)JSON schema definition for the 'make' tool input parameters: args (string), repo (string, required), branch (string, optional).inputSchema={ "type": "object", "properties": { "args": { "type": "string", "description": "Arguments to pass to make (e.g., 'clean', 'all', 'test')" }, "repo": { "type": "string", "description": "Repository name (required)" }, "branch": { "type": "string", "description": "Git branch name (optional). If provided, uses isolated worktree." } }, "required": ["repo"] } ),
- src/validators.py:118-139 (helper)Helper function to validate 'make' arguments, checking for dangerous shell patterns (e.g., ; | & >) and invalid characters, used in the handler to ensure safety.def validate_make_args(args: str) -> None: """ Validate make command arguments Args: args: Make command arguments Raises: ValueError: If arguments contain dangerous patterns """ if not args: return # Empty args is fine (will run default target) # Check for dangerous patterns if contains_dangerous_pattern(args): raise ValueError(f"Make arguments contain dangerous patterns: {args}") # Make arguments should be targets or variable assignments # Allow: alphanumeric, underscore, hyphen, equals, space, slash (for paths), quotes (for values with spaces) if not re.match(r'^[\*a-zA-Z0-9_\-=\s/\.\'"]+$', args): raise ValueError(f"Make arguments contain invalid characters: {args}")
- src/server.py:456-457 (registration)Dispatch logic in the generic call_tool handler that routes 'make' tool calls to the specific handle_make function.return await self.handle_make(arguments) elif name == "git":