Commit 50c6ed4
fix(run_tests): support snake_case params and handle double-serialized arrays (#690)
* fix(run_tests): support snake_case params and handle double-serialized arrays
The MCP tool schema defines filter parameters in snake_case (test_names,
group_names, etc.) but GetFilterOptions() only checked camelCase keys,
causing test filtering to silently fail — all tests would run instead of
the filtered subset.
Additionally, some MCP clients serialize array parameters as a stringified
JSON array inside an outer array (e.g. ["[\"name1\"]"]), which was not
handled by ParseStringArray().
Changes:
- Add snake_case fallback to all ParseStringArray calls in RunTests.cs
- Handle stringified JSON arrays in String token branch
- Handle double-serialized arrays in Array token branch
- Handle nested arrays ([[name1, name2]]) in Array token branch
- Add snake_case fallback for include_details/include_failed_tests in
both RunTests.cs and GetTestJob.cs
Fixes #689
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* refactor: extract GetParam and CoerceStringArray into ParamCoercion
Address code review feedback:
- Extract snake_case/camelCase param lookup into ParamCoercion.GetParam()
- Extract string array coercion (with double-serialization handling) into
ParamCoercion.CoerceStringArray()
- Narrow catch clauses from bare catch to JsonException
- Add explicit comment clarifying nested array unwrapping limitation
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* refactor: move CoerceStringArray to ToolParams and use GetRaw for snake_case fallback
Remove GetParam from ParamCoercion — ToolParams.GetRaw() already handles
snake_case/camelCase fallback via StringCaseUtility. Move CoerceStringArray
into ToolParams as GetStringArray() to centralize parameter handling.
Update RunTests and GetTestJob to use ToolParams instead.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>1 parent 8c6cefd commit 50c6ed4
File tree
3 files changed
+87
-31
lines changed- MCPForUnity/Editor
- Helpers
- Tools
3 files changed
+87
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
90 | 166 | | |
91 | 167 | | |
92 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
44 | | - | |
45 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
103 | 82 | | |
104 | 83 | | |
105 | 84 | | |
| |||
0 commit comments