Commit eb27e00
mcp: treat empty/whitespace wing or room as no filter in tool_search
Port of upstream 9947ad0 (PR MemPalace#1097) — LLM agents tend to fill optional
parameters with "" rather than omitting them. Without this normalization,
wing=" " (whitespace-only) is truthy in searcher.py and gets passed
as a literal filter, scoping the search to a non-existent empty wing
and returning zero results.
Adapted: upstream centralizes through a _sanitize_optional_name helper
that we don't have. Inlined the strip-and-empty-as-None at the entry
point of tool_search instead, which is the only call site with this
pattern in our fork (tool_list_rooms uses `if wing:` already-falsy on
"", and tool_find_tunnels accepts no LLM-driven optional filters).
Upstream: MemPalace@9947ad0
Co-authored-by: Kunal Garhewal <kunalgarhewal13@gmail.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0ec4b8c commit eb27e00
2 files changed
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 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 | + | |
| 166 | + | |
141 | 167 | | |
142 | 168 | | |
143 | 169 | | |
| |||
0 commit comments