#!/usr/bin/env python3 # A tools bundle that says who the runtime said called it (novox/hq issue 365): MCP over stdio, no SDK. Its tool # and its seat verb answer the caller the call's `_meta` named — "" when it named none — and the arguments as given. import json, sys def say(m): m["jsonrpc"] = "2.0"; sys.stdout.write(json.dumps(m) + "\n"); sys.stdout.flush() TOOLS = [ {"name": "who", "description": "who called", "inputSchema": {"type": "object", "properties": {}}}, {"name": "node-desk.who", "description": "who called the seat's verb", "inputSchema": {"type": "object", "properties": {}}}, ] for line in sys.stdin: req = json.loads(line); rid = req.get("id"); m = req.get("method"); p = req.get("params") or {} if m == "initialize": say({"id": rid, "result": {"protocolVersion": "2025-03-26", "capabilities": {"tools": {}}, "serverInfo": {"name": "ledger", "version": "1"}}}) elif m == "tools/list": say({"id": rid, "result": {"tools": TOOLS}}) elif m == "tools/call": meta = p.get("_meta") or {} said = {"caller": meta.get("mesh/caller", ""), "arguments": p.get("arguments") or {}} say({"id": rid, "result": {"content": [{"type": "text", "text": json.dumps(said)}]}}) elif rid is not None: say({"id": rid, "result": {}})