mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 01:21:43 +00:00
fix: use camelCase structuredContent attr, prefer structured over text
- The MCP SDK Pydantic model uses camelCase (structuredContent), not snake_case (structured_content). The original getattr was a silent no-op. - When structuredContent is present, return it AS the result instead of alongside text — the structured payload is the machine-readable data. - Move test file to tests/tools/ and fix fake class to use camelCase. - Patch _run_on_mcp_loop in tests so the handler actually executes.
This commit is contained in:
parent
363c5bc3c3
commit
b9a5e6e247
2 changed files with 35 additions and 27 deletions
|
|
@ -1255,13 +1255,10 @@ def _make_tool_handler(server_name: str, tool_name: str, tool_timeout: float):
|
|||
parts.append(block.text)
|
||||
text_result = "\n".join(parts) if parts else ""
|
||||
|
||||
# Preserve structured_content (structuredContent) if present
|
||||
structured = getattr(result, "structured_content", None)
|
||||
# Prefer structuredContent (machine-readable JSON) over plain text
|
||||
structured = getattr(result, "structuredContent", None)
|
||||
if structured is not None:
|
||||
return json.dumps({
|
||||
"result": text_result,
|
||||
"structuredContent": structured,
|
||||
})
|
||||
return json.dumps({"result": structured})
|
||||
return json.dumps({"result": text_result})
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue