From 789ca9efe5c3097b3cf50b2791c73378b6444670 Mon Sep 17 00:00:00 2001
From: Yunus <193119808+MohammediYunus@users.noreply.github.com>
Date: Wed, 7 Oct 2026 20:31:55 +0800
Subject: [PATCH] fix(read_console): allow excluding MCP diagnostics from
project checks
---
MCPForUnity/Editor/Helpers/McpLog.cs | 10 ++
MCPForUnity/Editor/Tools/ReadConsole.cs | 12 +-
Server/src/cli/commands/editor.py | 9 +-
Server/src/services/tools/read_console.py | 6 +-
.../integration/test_read_console_truncate.py | 22 +++-
Server/tests/test_cli.py | 7 ++
.../Tests/EditMode/Tools/ReadConsoleTests.cs | 114 ++++++++++++++++++
.../docs/reference/tools/core/read_console.md | 18 ++-
8 files changed, 192 insertions(+), 6 deletions(-)
diff --git a/MCPForUnity/Editor/Helpers/McpLog.cs b/MCPForUnity/Editor/Helpers/McpLog.cs
index ca9f77131..138a2bf26 100644
--- a/MCPForUnity/Editor/Helpers/McpLog.cs
+++ b/MCPForUnity/Editor/Helpers/McpLog.cs
@@ -1,3 +1,4 @@
+using System;
using MCPForUnity.Editor.Constants;
using UnityEditor;
using UnityEngine;
@@ -11,6 +12,15 @@ internal static class McpLog
private const string WarnPrefix = "MCP-FOR-UNITY:";
private const string ErrorPrefix = "MCP-FOR-UNITY:";
+ internal static bool IsMcpLogMessage(string message)
+ {
+ return message.StartsWith(InfoPrefix, StringComparison.Ordinal)
+ || message.StartsWith(DebugPrefix, StringComparison.Ordinal)
+ || message.StartsWith(WarnPrefix, StringComparison.Ordinal)
+ || message.StartsWith(ErrorPrefix, StringComparison.Ordinal)
+ || message.StartsWith("MCP-FOR-UNITY:", StringComparison.Ordinal);
+ }
+
private static volatile bool _debugEnabled = ReadDebugPreference();
private static bool IsDebugEnabled() => _debugEnabled;
diff --git a/MCPForUnity/Editor/Tools/ReadConsole.cs b/MCPForUnity/Editor/Tools/ReadConsole.cs
index b4abb5882..a2ab1ae88 100644
--- a/MCPForUnity/Editor/Tools/ReadConsole.cs
+++ b/MCPForUnity/Editor/Tools/ReadConsole.cs
@@ -192,6 +192,7 @@ public static object HandleCommand(JObject @params)
string filterText = p.Get("filterText");
string format = p.Get("format", "plain").ToLower();
bool includeStacktrace = p.GetBool("includeStacktrace", false);
+ bool includeMcpLogs = p.GetBool("includeMcpLogs", true);
if (types.Contains("all"))
{
@@ -205,7 +206,8 @@ public static object HandleCommand(JObject @params)
cursor,
filterText,
format,
- includeStacktrace
+ includeStacktrace,
+ includeMcpLogs
);
}
else
@@ -349,7 +351,8 @@ private static object GetConsoleEntries(
int? cursor,
string filterText,
string format,
- bool includeStacktrace
+ bool includeStacktrace,
+ bool includeMcpLogs
)
{
List