Commit fa92be2
committed
fix(mcp): restrict server prefix to ASCII and bound prefixed names to 64 chars
- `_server_tool_name_prefix`: add `char.isascii()` guard so non-ASCII
Unicode alphanumerics (e.g. CJK, Arabic) are replaced with `_` instead
of being passed through — OpenAI function names must be ASCII only.
- `_prefixed_tool_name`: cap the generated name at 64 characters; when
the full name exceeds the limit a deterministic 8-char SHA-1 suffix is
appended after truncation to keep names collision-resistant.
Addresses review feedback on #2788.1 parent d710186 commit fa92be2
1 file changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
| 281 | + | |
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
| |||
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
289 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
290 | 298 | | |
291 | 299 | | |
292 | 300 | | |
| |||
0 commit comments