mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 00:23:53 +08:00
fix: sanitize MCP tool names for OpenAI
This commit is contained in:
@@ -976,3 +976,8 @@ def is_valid_image_file(file_data: bytes) -> bool:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def sanitize_tool_name(name: str) -> str:
|
||||
"""Sanitize tool names for OpenAI compatibility."""
|
||||
return re.sub(r"[^a-zA-Z0-9_-]", "_", name)
|
||||
|
||||
Reference in New Issue
Block a user