Merge pull request #2102 from NousResearch/hermes/hermes-6757a563

fix(tools,cli): normalise MCP schemas + expand session list columns
This commit is contained in:
Teknium 2026-03-19 19:06:56 -07:00 committed by GitHub
commit d8081790f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 61 additions and 12 deletions

View file

@ -106,6 +106,18 @@ class TestSchemaConversion:
assert schema["parameters"]["type"] == "object"
assert schema["parameters"]["properties"] == {}
def test_object_schema_without_properties_gets_normalized(self):
from tools.mcp_tool import _convert_mcp_schema
mcp_tool = _make_mcp_tool(
name="ask",
description="Ask Crawl4AI",
input_schema={"type": "object"},
)
schema = _convert_mcp_schema("crawl4ai", mcp_tool)
assert schema["parameters"] == {"type": "object", "properties": {}}
def test_tool_name_prefix_format(self):
from tools.mcp_tool import _convert_mcp_schema
@ -1893,6 +1905,33 @@ class TestSamplingCallbackText:
messages = call_args.kwargs["messages"]
assert messages[0] == {"role": "system", "content": "Be helpful"}
def test_server_tools_with_object_schema_are_normalized(self):
"""Server-provided tools should gain empty properties for object schemas."""
fake_client = MagicMock()
fake_client.chat.completions.create.return_value = _make_llm_response()
server_tool = SimpleNamespace(
name="ask",
description="Ask Crawl4AI",
inputSchema={"type": "object"},
)
with patch(
"agent.auxiliary_client.call_llm",
return_value=fake_client.chat.completions.create.return_value,
) as mock_call:
params = _make_sampling_params(tools=[server_tool])
asyncio.run(self.handler(None, params))
tools = mock_call.call_args.kwargs["tools"]
assert tools == [{
"type": "function",
"function": {
"name": "ask",
"description": "Ask Crawl4AI",
"parameters": {"type": "object", "properties": {}},
},
}]
def test_length_stop_reason(self):
"""finish_reason='length' maps to stopReason='maxTokens'."""
fake_client = MagicMock()