normaliztion fix
This commit is contained in:
20
core/tools/normalize.py
Normal file
20
core/tools/normalize.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# core/tools/normalize.py
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
def normalize_tool_name(name: str) -> str:
|
||||||
|
"""
|
||||||
|
Converts transport-layer tool names (Continue MCP)
|
||||||
|
into internal registry tool names.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not isinstance(name, str):
|
||||||
|
raise ValueError("tool name must be string")
|
||||||
|
|
||||||
|
name = name.strip()
|
||||||
|
|
||||||
|
# Continue MCP prefix stripping
|
||||||
|
if name.startswith("vs_code_mcp_"):
|
||||||
|
return name[len("vs_code_mcp_"):]
|
||||||
|
|
||||||
|
return name
|
||||||
3
main.py
3
main.py
@@ -19,6 +19,7 @@ from core.executor import executor
|
|||||||
from core.tools.registry import registry
|
from core.tools.registry import registry
|
||||||
from core.tools.base import ToolContext
|
from core.tools.base import ToolContext
|
||||||
from tools.discovery import load_all_tools
|
from tools.discovery import load_all_tools
|
||||||
|
from core.tools.normalize import normalize_tool_name
|
||||||
|
|
||||||
|
|
||||||
# =========================
|
# =========================
|
||||||
@@ -72,7 +73,7 @@ def bind_registry_tools() -> None:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
return registry.run(
|
return registry.run(
|
||||||
name=bound_tool.name,
|
name=normalize_tool_name(bound_tool.name),
|
||||||
payload=kwargs,
|
payload=kwargs,
|
||||||
ctx=ctx
|
ctx=ctx
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user
