unity-mcp read_console returns ~13k tokens for 20–30 logs — how to get shorter output?
In unity-mcp (CoplayDev/unity-mcp), the read_console tool returns about 13.3k tokens for a simple project with only 20–30 debug log lines, which can quickly consume an agent's context window. Other users also hit "exceeding the maximum allowed tokens" errors on tools like unit test runners that dump full results. Is there a way to exclude stack traces or limit the output size, and has this been fixed in a recent version?
Originally asked on GitHub: https://github.com/CoplayDev/unity-mcp/issues/302
4 answers
Status: fixed. Maintainers closed this issue as completed in January 2026 after changes that reduced large payloads across the tools that return big datasets.
What changed in the thread:
- PR #304 fixed
read_consoleso thestacktraceparameter can actually be set tofalse, which produces shorter console log output instead of full stack traces. - Other tools were improved too. Unit test runs now return a short summary by default instead of a full unfiltered dump. Note that as of a December 31 test,
run_teststill dumped everything, so the summary behavior came with the early-January fix — update to the latest version. read_consolecan still return a large payload if there are many console messages; you can ask the tool to return only a fixed number of entries, e.g. 10 or 20.
If you are on an older build and hit an "exceeding the maximum allowed tokens" error, one user recovered by having the agent search the output for "summary" and then use a PowerShell
GET-CONTENTcommand to pull the results they needed.A collaborator confirmed there is a parameter to exclude the stack trace, but agreed it arguably should default to off — so set it explicitly if your client supports it. General advice: console logs and stack traces can contain file paths or data you may not want sent to the model, so trimming them also reduces what ends up in context.
Did this work for you?- PR #304 fixed
What @AndreMessier tried on GitHub (Partly worked)
After updating to the latest version, a user running unit tests still got an error about exceeding the maximum allowed tokens, but then searched the output for "summary" and used a PowerShell GET-CONTENT command, which returned the results they wanted.
Source: https://github.com/CoplayDev/unity-mcp/issues/302#issuecomment-3701295420 (opens external site)
Did this work for you?What @dsarno tried on GitHub (Outcome unclear)
A collaborator's PR #304 changed read_console so the stacktrace parameter can be set to false and produce shorter console logs. Maintainers asked the reporter to retry, but no explicit confirmation that it worked was posted.
Source: https://github.com/CoplayDev/unity-mcp/issues/302#issuecomment-3367588332 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
The reporter observed read_console returning ~13.3k tokens for only 20–30 log lines and asked whether stack traces could be excluded; no workaround was tried in the original report.
Source: https://github.com/CoplayDev/unity-mcp/issues/302 (opens external site)
Did this work for you?
Related questions
- Cursor "failed to create client" when Unity MCP project path contains spaces?
- Does unity-mcp support auto-approving MCP tool calls, or must I approve every call?
- unity-mcp doesn't work on Unity 2021.3.32 but works on 2022 - what's needed?
- unity-mcp: Cursor/Claude MCP tools fail with timeout or parse errors after updating?
- Unity MCP fails with "Invalid JSON format" when creating large C# scripts