{
"adapter_version": "0.4.0",
"fallback_init_result": {
"protocolVersion": "2024-11-05",
"capabilities": {
"tools": {
"listChanged": false
},
"resources": {
"listChanged": false,
"subscribe": false,
"subscribeSupported": false
}
},
"serverInfo": {
"name": "Ribir Debug Server",
"version": "0.4.0",
"description": "Debug and inspect running Ribir applications. Capture screenshots, explore widget tree, add visual overlays, view logs, and record frames. The HTTP server binds to 127.0.0.1:2333 and increments until a free port is found (fallback to a dynamic port). Use RIBIR_DEBUG_URL or the port registry for discovery."
}
},
"tools": [
{
"name": "start_app",
"description": "Start or attach a Ribir debug session for a runnable crate path. This tool first tries to attach an existing session for project_path, then launches `cargo run --features debug` if no session is found. Use an absolute crate path (not workspace root).",
"inputSchema": {
"type": "object",
"required": [
"project_path"
],
"properties": {
"project_path": {
"type": "string",
"description": "Absolute path to a runnable Rust crate directory containing Cargo.toml. Do not pass workspace root unless it is directly runnable."
},
"features": {
"type": "string",
"description": "Comma-separated extra features to merge with `debug`."
},
"cargo_args": {
"description": "Additional cargo arguments to pass to the run command.",
"oneOf": [
{
"type": "string",
"description": "Space-separated cargo arguments."
},
{
"type": "array",
"items": {
"type": "string"
},
"description": "Array form of cargo arguments."
}
]
},
"adopt": {
"type": "boolean",
"description": "Whether this MCP server should manage and stop the process via stop_app. Default true."
}
}
}
},
{
"name": "attach_app",
"description": "Attach to an already running Ribir debug server by explicit URL (for example from RIBIR_DEBUG_URL).",
"inputSchema": {
"type": "object",
"required": [
"url"
],
"properties": {
"url": {
"type": "string",
"description": "Debug server base URL, e.g. http://127.0.0.1:2333"
},
"adopt": {
"type": "boolean",
"description": "Attempt to adopt process ownership for cleanup via stop_app when PID can be resolved from registry."
}
}
}
},
{
"name": "stop_app",
"description": "Stop only the process currently managed by this MCP server (launched or adopted). No-op when nothing is managed.",
"inputSchema": {
"type": "object",
"properties": {}
}
},
{
"name": "capture_screenshot",
"description": "Capture a screenshot of the specified window. Returns the image as base64-encoded PNG data in the response.",
"inputSchema": {
"type": "object",
"properties": {
"window_id": {
"type": "string",
"description": "Window ID to capture (optional, defaults to primary)"
}
}
}
},
{
"name": "inspect_tree",
"description": "Get the full widget tree structure",
"inputSchema": {
"type": "object",
"properties": {
"window_id": {
"type": "string",
"description": "Window ID (optional)"
},
"options": {
"type": "string",
"description": "Filter what to show. Options: 'all' (everything), 'id' (WidgetId), 'layout' (pos+size), 'global_pos' (screen coords), 'clamp' (constraints), 'props' (properties). Prefix with 'no_' to exclude (e.g. 'all,no_props')."
}
}
}
},
{
"name": "inspect_widget",
"description": "Get details for a specific widget by ID",
"inputSchema": {
"type": "object",
"properties": {
"window_id": {
"type": "string",
"description": "Window ID (optional)"
},
"options": {
"type": "string",
"description": "Filter what to show. Options: 'all' (everything), 'id' (WidgetId), 'layout' (pos+size), 'global_pos' (screen coords), 'clamp' (constraints), 'props' (properties). Prefix with 'no_' to exclude (e.g. 'all,no_props')."
},
"id": {
"type": "string",
"description": "Widget ID to inspect. Supported formats: '3', '3:0', or '{\"index1\":3,\"stamp\":0}'."
}
},
"required": [
"id"
]
}
},
{
"name": "get_overlays",
"description": "List all active overlays",
"inputSchema": {
"type": "object",
"properties": {
"window_id": {
"type": "string",
"description": "Window ID (optional)"
}
}
}
},
{
"name": "set_log_filter",
"description": "Set the log filter (e.g., 'info,ribir_core=debug')",
"inputSchema": {
"type": "object",
"properties": {
"filter": {
"type": "string",
"description": "Filter string"
}
},
"required": [
"filter"
]
}
},
{
"name": "add_overlay",
"description": "Add a visual highlight overlay to a widget for debugging purposes",
"inputSchema": {
"type": "object",
"properties": {
"window_id": {
"type": "string",
"description": "Window ID (optional)"
},
"id": {
"type": "string",
"description": "Widget ID (e.g., '3', '3:0', or '{\"index1\":3,\"stamp\":0}')"
},
"color": {
"type": "string",
"description": "Color hex code (optional, #RRGGBB or #RRGGBBAA, default: #FF000080)"
}
},
"required": [
"id"
]
}
},
{
"name": "remove_overlay",
"description": "Remove a specific visual debug overlay from a widget",
"inputSchema": {
"type": "object",
"properties": {
"window_id": {
"type": "string",
"description": "Window ID (optional)"
},
"id": {
"type": "string",
"description": "Widget ID of the overlay to remove. Supported formats: '3', '3:0', or '{\"index1\":3,\"stamp\":0}'."
}
},
"required": [
"id"
]
}
},
{
"name": "clear_overlays",
"description": "Clear all visual debug overlays from the window",
"inputSchema": {
"type": "object",
"properties": {
"window_id": {
"type": "string",
"description": "Window ID (optional)"
}
}
}
},
{
"name": "start_recording",
"description": "Start a capture session for frame recording. Output is written under $RIBIR_CAPTURE_DIR (default ./captures/{capture_id}/frames).",
"inputSchema": {
"type": "object",
"properties": {
"include": {
"type": "array",
"items": {
"type": "string",
"enum": [
"logs",
"images"
]
},
"description": "Optional capture channels. Allowed values: 'logs', 'images'. Defaults to ['images'] when omitted."
}
}
}
},
{
"name": "stop_recording",
"description": "Stop the active recording session and return absolute capture and manifest paths.",
"inputSchema": {
"type": "object",
"properties": {}
}
},
{
"name": "capture_one_shot",
"description": "One-click capture: start -> request redraw (if images enabled) -> wait -> stop. Returns the capture session directory path. Default output directory is $RIBIR_CAPTURE_DIR or ./captures/{capture_id}/, containing frames/*.png, logs.jsonl and manifest.json",
"inputSchema": {
"type": "object",
"properties": {
"include": {
"type": "array",
"items": {
"type": "string",
"enum": [
"logs",
"images"
]
},
"description": "Capture channels to include. Allowed values: 'logs', 'images'."
},
"pre_ms": {
"type": "integer",
"description": "Ms of logs to include prior to start (default 2000)"
},
"post_ms": {
"type": "integer",
"description": "Ms of logs to include after stop (default 1000)"
},
"settle_ms": {
"type": "integer",
"description": "Extra time (ms) to wait after we observe a frame update (default 150)"
},
"output_dir": {
"type": "string",
"description": "Optional output directory"
}
},
"required": [
"include"
]
}
}
],
"resources": [
{
"uri": "ribir://logs",
"name": "Application Logs",
"description": "Recent application logs (last 100 lines). Access via resources/read method with the given URI",
"mimeType": "text/plain"
},
{
"uri": "ribir://windows",
"name": "Window List",
"description": "List of active windows. Access via resources/read method with the given URI",
"mimeType": "application/json"
},
{
"uri": "ribir://status",
"name": "Server Status",
"description": "Debug server status (recording, filter, stats). Access via resources/read method with the given URI",
"mimeType": "application/json"
}
]
}