forked from 1b-agent/opencadstudio-upstream
feat(mcp): add batch summaries with read-only detail retrieval
Add opt-in response_detail=summary with step and change counts, compact state, warnings, and actionable errors or prompts. Return an ocs_read batch_result request for full cached details without resuming mutations. Keep compact/full behavior and idempotent batch retries intact. Preserve active-step context and report unavailable cached results explicitly. Document cache scope and retention; update schemas and digest. Validation: 47 MCP unit tests, live stdio smoke test, rustfmt, and diff checks passed.
This commit is contained in:
1 parent
f4b33d5cde
commit
7b68d274ad
3 files changed
+322
-10
No files matched your search
@@ -51,6 +51,8 @@ def legacy(server: Path) -> None:
|
||||
definitions = {tool["name"]: tool for tool in tools["result"]["tools"]}
|
||||
names = set(definitions)
|
||||
assert names == TOOLS, names
|
||||
assert "summary" in definitions["ocs_execute"]["inputSchema"]["properties"]["response_detail"]["enum"]
|
||||
assert "batch_result" in definitions["ocs_read"]["inputSchema"]["properties"]["op"]["enum"]
|
||||
execute_request = definitions["ocs_execute"]["inputSchema"]["properties"]["request"]
|
||||
variants = execute_request.get("anyOf") or execute_request.get("oneOf")
|
||||
# Resolve local references from the complete tool input schema.
|
||||
@@ -103,6 +105,15 @@ def legacy(server: Path) -> None:
|
||||
"params": {"name": "ocs_sessions", "arguments": {"launch_if_none": False}},
|
||||
})
|
||||
assert not sessions["result"].get("isError"), sessions
|
||||
missing_batch = request(process, {
|
||||
"jsonrpc": "2.0", "id": 4, "method": "tools/call",
|
||||
"params": {"name": "ocs_read", "arguments": {
|
||||
"ocs_session_id": "missing", "op": "batch_result",
|
||||
"parameters": {"request_id": "expired-batch"},
|
||||
}},
|
||||
})
|
||||
assert missing_batch["result"]["isError"] is True
|
||||
assert "absent or expired" in missing_batch["result"]["content"][0]["text"]
|
||||
close(process)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user