Skip to content

feat(mcp): typed tools, structured errors and schema contract - #4450

Merged
zackees merged 12 commits into
masterfrom
infra/control-api-typed
Nov 10, 2026
Merged

zackees merged 12 commits into
masterfrom
infra/control-api-typed

Conversation

@zackees

@zackees zackees commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

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:

  • Focused MCP suite: 62 passed in the existing obs-tests-core binary.
  • Full ./unittest: 7,670 passed, one snapshot drift failure while annotations were being updated; focused final-tree rerun passed. The full command stopped before Tier 2.
  • ./lint --fix: exposed existing master failures tracked by ci: master fails Fast Gate after three of today's merges #4443 (duplicate hotkey unity membership and bare Python shebang), plus the pre-existing browser pointer expectation. Fixed this slice's workspace dependency declaration; dependency policy tests pass.
  • Native-backend Clippy: soldr cargo clippy -p obs-mcp --features libobs -- -D warnings passed.
  • soldr cargo build -p obs-studio-rust passed. Built the required release libobs-rust archive successfully (26.53 s). With OBS_BUILD_RUST_ARCHIVE set, the MCP-enabled build fails because x11.pc is unavailable; probes also cannot find libavcodec/jansson in the native pkg-config closure.
  • Real CLI stdin tools/list attempt exits 1, stdout empty, stderr: error: this build has no libobs; rebuild with --features bundled-native. No GUI/device runs performed. Real-app verification remains blocked; therefore Refs rather than Fixes.

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.

@zackees zackees changed the title test(mcp): RED typed tool schema and structured result contract (#4445) feat(mcp): typed tools, structured errors and schema contract Nov 9, 2026
@zackees
zackees marked this pull request as draft November 9, 2026 21:34
@zackees

zackees commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

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.

@zackees

zackees commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

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
@zackees
zackees marked this pull request as ready for review November 9, 2026 23:46
@zackees
zackees added this pull request to the merge queue Nov 9, 2026
@zackees

zackees commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

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.

Merged via the queue into master with commit 9899c56 Nov 10, 2026
41 checks passed
@zackees
zackees deleted the infra/control-api-typed branch November 10, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant