fix(mcp): clarify enabledTools filtering semantics

- support both raw and wrapped MCP tool names
- treat [\"*\"] as all tools and [] as no tools
- add warnings, tests, and README docs for enabledTools
This commit is contained in:
Xubin Ren
2026-03-14 10:26:15 +00:00
committed by Xubin Ren
parent 40fad91ec2
commit a1241ee68c
4 changed files with 241 additions and 6 deletions

View File

@@ -140,7 +140,7 @@ class MCPServerConfig(Base):
url: str = "" # HTTP/SSE: endpoint URL
headers: dict[str, str] = Field(default_factory=dict) # HTTP/SSE: custom headers
tool_timeout: int = 30 # seconds before a tool call is cancelled
enabled_tools: list[str] = Field(default_factory=list) # Only register these tools; empty = all tools
enabled_tools: list[str] = Field(default_factory=lambda: ["*"]) # Only register these tools; accepts raw MCP names or wrapped mcp_<server>_<tool> names; ["*"] = all tools; [] = no tools
class ToolsConfig(Base):
"""Tools configuration."""