feat(mcp): serve specialist guides on demand and shorten instructions

This commit is contained in:
Karim Jerbi committed 2026-10-12 15:20:28 +01:00
1 parent 50030be8c2
commit 8943a6fd39
5 files changed
+169 -6

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
# Architectural vectorization
When converting or vectorizing a floorplan from an image or sketch:
1. Attach reference images as Xref underlays via embed_image on layer _XREF and lock it.
2. NEVER draw loose lines or arcs for doors or windows; always query records (collection: 'block_records') and insert Block References (type: 'INSERT') on A-DOOR and A-GLAZ. If a block is missing, draft standard geometry at origin (0,0) and register it with block_define before inserting.
3. Categorize layers cleanly: A-WALL-EXTR, A-WALL-INTR, A-WALL-HATCH, A-DOOR, A-GLAZ, A-ANNO-TEXT, A-ANNO-DIMS.
4. Always verify drafted geometry using ocs_capture with annotate: true (Set-of-Marks entity IDs) and diff: true (visual dirty streaming).
+5
View File
@@ -0,0 +1,5 @@
# Captures and visual verification
ocs_capture operates quietly in background and overlapped window states without stealing user focus. Viewports and captured snapshots are available as MCP resources under cad://session/{session_id}/viewport.png and cad://session/{session_id}/snapshot/{hash}.png; ocs_capture accepts delivery: 'resource' to avoid large inline base64 payloads, supplies standardized spatial grounding in _spatial, supports diff: true for streaming dirty visual regions, and provides multiscale DeepZoom pyramidal tiling via tile: {level, x, y} or cad://session/{session_id}/pyramid/manifest.json and cad://session/{session_id}/tile/{level}/{x}/{y}.png.
Use annotate: true for entity IDs and diff: true for visual changes. Unchanged diff captures omit image data. delivery: resource returns a resource_link; read its URI only when you need the image. delivery: both includes the link and inline image.
+13
View File
@@ -0,0 +1,13 @@
# CAD automation workflow
Call ocs_sessions, then pass its session_id as ocs_session_id to ocs_read, ocs_execute and ocs_capture. Read capabilities to discover the complete CAD automation surface. Call record_schema to discover every record type, property path, JSON type, enum, unit, constraint and write rule before editing unfamiliar data. Use records to inspect every serializable entity, object, table, header and document record; filter with RFC 6901 JSON Pointer paths. Use set_properties for atomic, type-checked record edits and preserve document_id, revision and request_id.
Use commands with parameters.name for a command manifest. Use batch when several steps are known, and request changed_entities when resulting geometry is needed.
For interactive work, call start and follow state.command.accepts, options and input_example. To have the person at the screen pick entities for you, call user_select and keep polling until it completes; running means they are still picking. A run.cmd contains the command name followed by prompt answers separated by spaces; points use x,y or x,y,z.
After a timeout, query the existing operation and never replay a mutation with a new request_id. waiting_input and running are not completion. Let OCS and its geometry kernel calculate geometry; use query near, contains_point and intersections for exact relationships.
Before delivery call audit with the intended target_format and target_version; use save_verified with an explicit absolute path to save, reopen, hash and compare the semantic manifest. When you first connect, announce the build you are working with to the user from the `bridge` object on ocs_sessions states and hello/capabilities responses (OpenCADStudio version, build_rev, tool_schema digest); repeat the announcement if a later handshake reports a different build.
For dependent batch steps, read cad://guides/batch-bindings. Use response_detail: summary to reduce batch output; retrieve retained details using ocs_read op: batch_result with parameters.request_id in the same MCP connection.
+21
View File
@@ -114,6 +114,27 @@ def legacy(server: Path) -> None:
})
assert missing_batch["result"]["isError"] is True
assert "absent or expired" in missing_batch["result"]["content"][0]["text"]
guides = request(process, {
"jsonrpc": "2.0", "id": "guides", "method": "resources/list",
})
guide_uris = {r["uri"] for r in guides["result"]["resources"]
if r["uri"].startswith("cad://guides/")}
assert guide_uris == {f"cad://guides/{name}" for name in
("workflow", "architecture", "capture", "batch-bindings")}
for uri in sorted(guide_uris):
resource = request(process, {
"jsonrpc": "2.0", "id": uri, "method": "resources/read", "params": {"uri": uri},
})
assert resource["result"]["contents"][0]["text"].startswith("# ")
guide_tool = request(process, {
"jsonrpc": "2.0", "id": "guide-tool", "method": "tools/call",
"params": {"name": "ocs_read", "arguments": {
"ocs_session_id": "offline", "op": "guide", "parameters": {"name": "capture"},
}},
})
assert not guide_tool["result"].get("isError"), guide_tool
assert guide_tool["result"]["structuredContent"]["ok"] is True
assert "resource_link" in guide_tool["result"]["structuredContent"]["contents"][0]["text"]
close(process)