Repository navigation
feat(mcp): typed tools, structured errors and schema contract - #4450
Conversation
|
Final-head focused validation: all 62 MCP tests pass (8adc952), including schema/registration drift and structured status codes. Native-backend Clippy passed. Default CLI build and the prerequisite release libobs-rust archive build both passed. MCP-enabled application build with OBS_BUILD_RUST_ARCHIVE set stops at missing x11.pc; real tools/list smoke remains blocked (default CLI reports that bundled-native is required). Current required CI failure logs on run 42708651038 match #4443: Format checks report duplicate hotkey membership and the pre-existing Python shebang; Fast Gate reports clang-format violations in libobs/obs-internal.h:2348 and libobs/obs-output.c.h:2562. These files are outside this PR. No queue entry or coordinator handoff: the PR remains draft because required CI and real-app verification have not passed. |
|
Resumed per maintainer instruction and read gh run view 42708651038 --job --log-failed for Format (129472068925), Fast Gate (129472380588), Linux Tier 2 (129472380655), Windows Tier 2 (129472380741) and CI Gate (129476746774). Compared affected files with freshly fetched origin/master (ce04e66): no differences in libobs/build/libobs.core+.h.c, libobs/obs-internal.h, libobs/obs-output.c.h or ci/hooks/pre_commit_fmt.py. Windows reports LNK2005 obs_hotkey_update_atomic; the same duplicate membership is present on master and explains the Linux link failure. CI Gate aggregates these upstream failures. Rebase onto origin/master was a no-op. These are #4443, currently claimed by rdoupe; no PR-specific fix identified. Continuing remaining Control API slices while tracking the baseline repair, then will rebase, mark ready and queue when required CI passes. |
* ci: fix master self-tests broken by unchecked merges #4387 re-added obs-hotkey-update-atomic.c.h to libobs.core+ after #4220 moved it to its ported group, so the C body was compiled twice (test_build_groups, test_ported_sources, test_conversion_measure). #4136 gave ci/hooks/pre_commit_fmt.py a bare python3 shebang (test_uv_run). Both landed through admin merges without CI on 2026-11-09. * libobs: clang-format two files from unchecked merges
|
Native runtime verification now succeeds on the completed Control API stack: target/debug/obs-studio-rust --mcp reads tools/list from stdin and exits 0; JSON-RPC id 1 returns 30 tools, every one with outputSchema. Existing typed tools are included unchanged. Headless socket/listen + --mcp-attach also exits 0 with the same 30 tools and removes the socket on stdin EOF. Native build used soldr, the release libobs-rust archive and realized Nix native dependencies; no GUI/device run occurred on the host. #4450 remains in the merge queue awaiting its merge-group Fast Gate. |
Refs #4445. Parent #4444.
OBS MCP tools now declare serde/schemars input and output structs. A blanket TypedTool adapter publishes outputSchema and structuredContent, preserves successful JSON text and screenshot image content, rejects unknown fields, and separates JSON-RPC argument faults from structured OBS domain failures. Existing names, output descriptions and JSON text field ordering remain compatible. Read operations carry read-only hints; output start/stop are idempotent. Native missing outputs preserve a retryable NotReady failure. Backend tools use request/response methods, retaining legacy hooks for existing implementers.
Adds the short Control API design and a generated schema snapshot with drift tests. Native Windows pipe support, device/media/stat domains, waiting, attachment and client work remain in #4446–#4449; #4446 additionally depends on #4124, whose native PipeWire node/counters have not landed on master.
RED: 59f2012 runs the new obs-tests-core contract against todo!() adapter stubs and fails in typed_schema_and_structured_result. GREEN: eca653e plus fixups; 62 MCP tests pass, including status codes, malformed arguments, structured results and schema/registration drift. Uses actual v5 statuses: 600 ResourceNotFound, 207 NotReady, 604 InvalidResourceState, 702 RequestProcessingFailed. No public C headers, C tests or obs-websocket plugin changes.
Validation:
Test cost: typed module longest 0.036 s, peak child RSS 18,292 KiB over 25 runs (five typed cases); tests create no own threads. New cases stay in the shared category binary. New code does not port C behavior, so no new Tier 3 oracle is applicable; unchanged Tier 2/native regression coverage remains required in CI.
Review: one clud-review agent found two medium issues (annotations and native readiness classification); both corrected. Pushed through ./push without client attestation after stopping its optional cold C-oracle Clippy build after more than ten minutes. Required CI/queue landing is blocked by master regression #4443. Keep draft until the native smoke test and required checks pass.