MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / unwrap_tool_json

Function unwrap_tool_json

scripts/hermes_stock_check.py:38–46  ·  view source on GitHub ↗

Decode a generated-tools.py response: MCP envelope with JSON text.

(raw)

Source from the content-addressed store, hash-verified

36
37
38def unwrap_tool_json(raw):
39 """Decode a generated-tools.py response: MCP envelope with JSON text."""
40 outer = json.loads(raw)
41 assert "error" not in outer, f"tool dispatch returned an error: {outer}"
42 content = outer["content"]
43 assert content and content[0]["type"] == "text", outer
44 inner = json.loads(content[0]["text"])
45 assert "error" not in inner, f"tool payload carries an error: {inner}"
46 return inner
47
48
49def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected