refs #699: honor MCP tool input schemas

This commit is contained in:
devmrko
2026-07-22 20:13:17 +09:00
parent ee355a9282
commit d6a558e45a
3 changed files with 63 additions and 18 deletions

View File

@@ -8,6 +8,7 @@ from unittest.mock import patch
from src.poc4.scenarios import ScenarioConfigError, load_demo_scenarios
from src.agent_console.profile import load_app_profile
from src.mcp_tool_router import McpTool, build_mcp_tool_arguments
class DemoScenarioConfigTest(unittest.TestCase):
@@ -74,6 +75,42 @@ class DemoScenarioConfigTest(unittest.TestCase):
with self.assertRaises(ScenarioConfigError):
load_demo_scenarios(path)
def test_default_mcp_tool_arguments_follow_discovered_query_schema(self) -> None:
tool = McpTool(
name="search_hr_data",
description="",
schema={
"type": "object",
"properties": {"query": {"type": "string"}},
"required": ["query"],
},
read_only=True,
)
arguments = build_mcp_tool_arguments(
tool, "직원 E1005의 휴가 신청 내역", 50, preferred_tool="search_hr_data"
)
self.assertEqual(arguments, {"query": "직원 E1005의 휴가 신청 내역"})
def test_term_tool_arguments_follow_discovered_term_schema(self) -> None:
tool = McpTool(
name="resolve_hr_term",
description="",
schema={
"type": "object",
"properties": {"term": {"type": "string"}},
"required": ["term"],
},
read_only=True,
)
arguments = build_mcp_tool_arguments(
tool, "반차", 50, preferred_tool="search_hr_data"
)
self.assertEqual(arguments, {"term": "반차"})
if __name__ == "__main__":
unittest.main()