Skip to content

spec(port): port specs/port/trios/crates/trios-server/src/mcp.t27 (Closes #9563) - #9803

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9563-server-mcp
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9563-server-mcp

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios:crates/trios-server/src/mcp.rs (at 8b229e9489ee, 338 lines) as specs/port/trios/crates/trios-server/src/mcp.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9563.

The original serves the trios tool catalog over MCP: build_tool_definitions declares the tools, prop_type / prop_array_items build the JSON-Schema property descriptors, McpService::list_tools answers the catalog, and McpService::call_tool dispatches a call and wraps its result.

Per the issue's rule ("Port the decision, not the plumbing"), the six listed functions are ported under their names — five as tested pure functions, the McpService_call_tool dispatch as an undefined; transport no test calls — and the decisions are ported with 9 tests (33 runtime asserts, 0 vacuous):

  • prop_type — a property descriptor carrying its named type; prop_array_items — the array-of-strings descriptor (lines 13-24);
  • build_tool_definitions — the nineteen-tool catalog by count, with tool_name carrying every name: git basic and extended (status, stage_files, unstage_files, commit, create_branch, log, diff, stash, checkout), gb (list_branches, push_stack, workspace_status), fs (read_file, write_file, list_dir), kg (create_entity, create_edge, query, traverse) (lines 26-280);
  • the per-tool facts: git_status's description and its single required string property; git_stage_files's two required properties with the array descriptor; git_log's integer limit defaulting to 10 (lines 57-108);
  • McpService_new / McpService_list_tools — the Rust zero-sized struct keeps its empty shape, and the list answer carries the whole catalog with no meta and no next cursor (lines 281-295);
  • the call wrapper's rules (lines 297-337): absent arguments become JSON null (arguments_become_null); object and array results render as pretty JSON text, strings pass through, everything else renders compact (result_text_kind); the answer is exactly one content block (content_block_count); a failed dispatch answers an Error: -prefixed text with is_error set (call_result_is_error, error_text_prefix).

The serde_json maps, the LazyLock static and the dispatch await are plumbing; the growable Vec<Tool> is carried by the count and the name table.

Verification (all run live from the worktree root, zig 0.16.0)

  • t27c parse: OK. t27c spec-status: IMPLEMENTED. t27c typecheck: 0 errors, 0 warnings.
  • t27c coverage: 18/19 tested — only the McpService_call_tool transport untested, by design.
  • t27c test-report: 9 tests / 9 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 213 (> 12).
  • grep -cE '^\s*(pub )?fn (prop_type|prop_array_items|build_tool_definitions|McpService_new|McpService_list_tools|McpService_call_tool)\(': 6. grep -cE '^\s*test\s+(["|[A-Za-z_])': 9 (≥ 6).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit (foreign-budget, own-language) passed.
  • dupe_scan by name: all 13 helper names unique across 2040 specs on a clean origin/master worktree. Bare body scan: the new file adds no duplicate group — 752 duplicate bodies in 221 groups on base, identical with this spec present (2041 specs scanned).

Dmitrii Fedorov (@dmitrii-f-t27)

…oses gHashTag#9563)

Port gHashTag/trios:crates/trios-server/src/mcp.rs (at 8b229e9489ee,
338 lines) as specs/port/trios/crates/trios-server/src/mcp.t27 -
Roadmap Stage 6, goal gHashTag#4548, target t27c gen-rust.

The MCP service's decisions are ported as pure functions and tested
(9 tests, 9 pass, 0 vacuous, 33 runtime asserts): the property
descriptor shapes (a named type; the array-of-strings descriptor),
the nineteen-tool catalog by count and by name (git basic and
extended, gb, fs, kg), the per-tool facts (git_status's description
and single string property, git_stage_files's two required
properties with the array descriptor, git_log's integer limit
defaulting to 10), the list answer's shape (the whole catalog, no
meta, no next cursor), and the call wrapper's rules - absent
arguments become JSON null, object and array results render pretty,
strings pass through, everything else renders compact, exactly one
content block, and a failed dispatch answers an Error-prefixed text
with is_error set. The call_tool transport keeps its name with an
undefined; body no test calls; the Rust ZST service keeps its empty
struct shape under McpService_new.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 18/19 (only the call_tool transport untested, by design),
test-report 9/9 pass, 0 BLOCKED, gen 213 lines with 0 'not yet
implemented', boundary exactly this one file, dupe_scan: all 13
helper names unique across 2040 specs, and the bare body scan adds
no duplicate group (752 bodies / 221 groups unchanged).

Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
@dmitrii-f-t27

Copy link
Copy Markdown
Contributor Author

@gHashTag Please merge this PR into master via the golden chain — rights on gHashTag/t27 are read-only for me (403), so the merge itself needs your action.

What this is: the #9563 port — crates/trios-server/src/mcp.rs (gHashTag/trios, at 8b229e9489ee, 338 lines) re-authored as specs/port/trios/crates/trios-server/src/mcp.t27. One file, head d3cb5f514, Closes #9563.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 18/19 (only the McpService_call_tool transport untested, by design), t27c test-report 9 tests / 9 pass / 0 FAIL / 0 BLOCKED, 0 vacuous.
  • gen → 213 lines, 0 not yet implemented; the 6 required names count exactly 6; 9 test blocks; boundary exactly the one file.
  • dupe_scan by name: all 13 helper names unique across 2040 specs on a clean origin/master worktree. Bare body scan: no new duplicate group — 752 duplicate bodies in 221 groups on base, identical with this spec present.
  • The t27b-native-run artifact of this head (commit d3cb5f5, run 38987660763): mcp.t27 row — reference pass, t27b pass, tests 9, invariants 0, asserts 33, blockers [], detail empty, reference_disagree: [].

CI (head d3cb5f5): required trio green — validate, check-linked-issue, parse-ratchet; 26 checks pass overall, incl. emit-bitexact, t27b-native-linux, t27b-native-macos, coverage, own-language.

The 3 reds are the base-red trio, not this change: cli-tri (the include_str! of the #3324-removed workflow file), duplicate-bodies (only the known base names; zero mention of this spec's names, verified in the log), t27b-native-ratchet (the same verdict red the Queen's port PRs carry; this spec's own row is reference pass + t27b pass, its registration debt is the UNLISTED class).

After the merge I will: verify the spec file live on the merge SHA, confirm #9563 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

@gHashTag
gHashTag merged commit 19fbc08 into gHashTag:master Oct 17, 2026
26 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port gHashTag/trios:crates/trios-server/src/mcp.rs (Rust, 6 functions) to specs/port/trios/crates/trios-server/src/mcp.t27

2 participants