Skip to main content

read_console

Auto-generated from the Python tool registry. Do not hand-edit outside <!-- examples:start --><!-- examples:end --> blocks — the generator (tools/generate_docs_reference.py) will overwrite them.

Group: core  ·  Module: services.tools.read_console

Maturity: stable (support status; independent of enabled state, readiness and permissions).

Description​

Gets messages from or clears the Unity Editor console. Defaults to 10 most recent entries, excluding MCP internal logs; set include_mcp_logs=true for troubleshooting. Use page_size/cursor for paging. Note: For maximum client compatibility, pass count as a quoted string (e.g., '5'). The 'get' action is read-only; 'clear' modifies ephemeral UI state (not project data).

Parameters​

NameTypeRequiredDescription
actionLiteral['get', 'clear'] | None—Get or clear the Unity Editor console. Defaults to 'get' if omitted.
typeslist[Literal['error', 'warning', 'log', 'all']] | str | None—Message types to get (accepts list or JSON string)
countint | str | None—Max messages to return in non-paging mode (default 10; accepts int or string, e.g., 5 or '5'). Pass 'all' or '*' to return all matches. Ignored when paging with page_size/cursor.
filter_textstr | None—Text filter for messages
page_sizeint | str | None—Page size for paginated console reads. Defaults to 50 when omitted.
cursorint | str | None—Opaque cursor for paging (0-based offset). Defaults to 0.
formatLiteral['plain', 'detailed', 'json'] | None—Output format
include_stacktracebool | str | None—Include stack traces in output (accepts true/false or 'true'/'false')
fieldslist[Literal['type', 'message', 'file', 'line', 'stackTrace']] | str | None—Optional fields for get with json/detailed format; accepts a list or JSON list string. Must include type and message. stackTrace requires include_stacktrace=true. Omit to preserve the full existing entry schema.
include_mcp_logsbool | str—Include MCP internal logger messages (default false). Filtering occurs before count and pagination.
tail_cursorstr | None—Opt-in incremental tail: begin starts at the current end; otherwise pass the returned opaque token. Loss cannot be ruled out.
unity_instancestr | int | None—Target Unity instance for this call: Name@hash or hash prefix; an integer selects only that exact port over stdio and is rejected over HTTP. Read mcpforunity://instances for available targets. Omit to use the legacy active selection or the sole available instance.

Returns​

A dict containing the Unity response. The exact shape depends on the action.

Examples​

Inspect recent errors and warnings without clearing the Console. This requests a bounded JSON result with the message and its source location.

MCP arguments
{
"action": "get",
"types": [
"error",
"warning"
],
"count": "20",
"format": "json",
"fields": [
"type",
"message",
"file",
"line"
]
}