Skip to content

Commit cc2cb1a

Browse files
Saqooshaclaude
andcommitted
fix: Map 'info' log type to Unity's 'Log' type for console log retrieval
The get_console_logs tool was unable to retrieve info logs because MCP's "info" parameter didn't match Unity's internal "Log" type string. Added mapping logic to convert "info" to "Log" before filtering log entries. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cb4b03c commit cc2cb1a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Editor/Services/ConsoleLogsService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ public JArray GetAllLogsAsJson(string logType = "")
8080
{
8181
foreach (var entry in _logEntries)
8282
{
83-
if (filter && !entry.Type.ToString().Equals(logType, System.StringComparison.OrdinalIgnoreCase))
83+
// Map MCP log types to Unity log types
84+
string unityLogType = logType;
85+
if (logType.Equals("info", System.StringComparison.OrdinalIgnoreCase))
86+
unityLogType = "Log";
87+
88+
if (filter && !entry.Type.ToString().Equals(unityLogType, System.StringComparison.OrdinalIgnoreCase))
8489
continue;
8590
logsArray.Add(new JObject
8691
{

0 commit comments

Comments
 (0)