Skip to main content
Glama

godot_run_with_capture

Execute a Godot project or scene for a specified duration to capture runtime output including stdout, stderr, logs, warnings, and errors for debugging and analysis.

Instructions

Run a Godot project or a specific scene for a short capture window and return stdout, stderr, log output, plus parsed warnings and errors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath to the Godot project directory or its project.godot file.
scene_pathNoOptional scene to run instead of the project's configured main scene.
headlessNoWhether to run in headless mode during capture.
capture_secondsNoHow long to let the project or scene run before stopping it and collecting output.
max_output_charsNoMaximum number of characters to return for stdout, stderr, and log output excerpts.
godot_executableNoOptional explicit path to the Godot executable or .app bundle.

Implementation Reference

  • Implementation of the run_with_capture tool logic in the GodotController class.
    def run_with_capture(
        self,
        project_path: str,
        scene_path: str | None = None,
        godot_executable: str | None = None,
        headless: bool = False,
        capture_seconds: float = 3.0,
        max_output_chars: int = 12000,
    ) -> dict[str, Any]:
        project_dir = ensure_project_path(project_path)
        executable, version = resolve_godot_executable(godot_executable)
        if capture_seconds <= 0:
            raise GodotError("`capture_seconds` must be greater than 0.")
    
        command = [str(executable), "--log-file", str(_create_log_path(project_dir, "run-capture")), "--path", str(project_dir)]
        absolute_scene_path: Path | None = None
        resource_scene_path: str | None = None
        run_target = "project"
        if headless:
            command.append("--headless")
        if scene_path:
            absolute_scene_path, resource_scene_path = resolve_scene_path(project_dir, scene_path)
            if not absolute_scene_path.exists():
                raise GodotError(f"Scene not found: {absolute_scene_path}")
            command.append(str(absolute_scene_path))
            run_target = "scene"
    
        log_path = Path(command[2])
        process = subprocess.Popen(
            command,
            cwd=project_dir,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True,
        )
    
        terminated_after_capture = False
        force_killed = False
        try:
            stdout_text, stderr_text = process.communicate(timeout=capture_seconds)
        except subprocess.TimeoutExpired:
            terminated_after_capture = True
            process.terminate()
            try:
                stdout_text, stderr_text = process.communicate(timeout=5)
            except subprocess.TimeoutExpired:
                force_killed = True
                process.kill()
                stdout_text, stderr_text = process.communicate(timeout=5)
    
        log_text = log_path.read_text(encoding="utf-8", errors="replace") if log_path.exists() else ""
        stdout_excerpt, stdout_truncated = _truncate_text(stdout_text, max_output_chars)
        stderr_excerpt, stderr_truncated = _truncate_text(stderr_text, max_output_chars)
        log_excerpt, log_truncated = _truncate_text(log_text, max_output_chars)
        debug_output = _classify_debug_lines(stdout_text, stderr_text, log_text)
    
        return {
            "project_path": str(project_dir),
            "scene_path": str(absolute_scene_path) if absolute_scene_path is not None else None,
            "scene_resource_path": resource_scene_path,
            "run_target": run_target,
            "command": command,
            "log_path": str(log_path),
            "headless": headless,
            "capture_seconds": capture_seconds,
            "exit_code": process.returncode,
            "terminated_after_capture": terminated_after_capture,
            "force_killed": force_killed,
            "stdout": stdout_excerpt,
            "stderr": stderr_excerpt,
            "log_output": log_excerpt,
            "stdout_truncated": stdout_truncated,
            "stderr_truncated": stderr_truncated,
            "log_output_truncated": log_truncated,
            "debug_output": debug_output,
            "godot_version": version,
        }
  • Registration of the godot_run_with_capture tool in the MCP server.
        name="godot_run_with_capture",
        description="Run a Godot project or a specific scene for a short capture window and return stdout, stderr, log output, plus parsed warnings and errors.",
        input_schema={
            "type": "object",
            "properties": {
                "project_path": {
                    "type": "string",
                    "description": "Path to the Godot project directory or its project.godot file.",
                },
                "scene_path": {
                    "type": "string",
                    "description": "Optional scene to run instead of the project's configured main scene.",
                },
                "headless": {
                    "type": "boolean",
                    "description": "Whether to run in headless mode during capture.",
                    "default": False,
                },
                "capture_seconds": {
                    "type": "number",
                    "description": "How long to let the project or scene run before stopping it and collecting output.",
                    "default": 3.0,
                },
                "max_output_chars": {
                    "type": "integer",
                    "description": "Maximum number of characters to return for stdout, stderr, and log output excerpts.",
                    "default": 12000,
                    "minimum": 1,
                },
                "godot_executable": {
                    "type": "string",
                    "description": "Optional explicit path to the Godot executable or .app bundle.",
                },
            },
            "required": ["project_path"],
            "additionalProperties": False,
        },
        handler=lambda args: self.controller.run_with_capture(
            project_path=args["project_path"],
            scene_path=args.get("scene_path"),
            headless=bool(args.get("headless", False)),
            capture_seconds=float(args.get("capture_seconds", 3.0)),
            max_output_chars=int(args.get("max_output_chars", 12000)),
            godot_executable=args.get("godot_executable"),
        ),
    ),
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool runs for a 'short capture window' and returns parsed outputs, which adds useful context beyond the input schema. However, it doesn't cover critical aspects like error handling, performance impacts, or system requirements, leaving gaps for a tool that executes external processes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that efficiently conveys the tool's purpose and key features without unnecessary words. It's front-loaded with the main action and outcome, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of running an external Godot project with capture and parsing, and with no annotations or output schema provided, the description is somewhat incomplete. It mentions the return types but doesn't detail the structure or format of the parsed outputs, which could leave the agent uncertain about how to handle the results. However, it covers the core functionality adequately.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description doesn't add any additional meaning or clarification about the parameters beyond what's in the schema, such as explaining interactions between 'project_path' and 'scene_path'. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Run a Godot project or a specific scene'), the resource involved, and the outcome ('return stdout, stderr, log output, plus parsed warnings and errors'). It distinguishes this tool from siblings like 'godot_run_project' and 'godot_run_scene' by specifying the capture window and output parsing features.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for short-term execution with output capture, but it doesn't explicitly state when to use this tool versus alternatives like 'godot_run_project' or 'godot_run_scene'. No exclusions or prerequisites are mentioned, leaving the agent to infer context from the tool name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/MhrnMhrn/godot-mcp'

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