Skip to content

feat(mcp): assert_output MCP tool — G2b (closes #60)#92

Merged
PowerCreek merged 1 commit into
mainfrom
assert-output-g2b-60
May 25, 2026
Merged

feat(mcp): assert_output MCP tool — G2b (closes #60)#92
PowerCreek merged 1 commit into
mainfrom
assert-output-g2b-60

Conversation

@PowerCreek

Copy link
Copy Markdown

Summary

Closes #60 (G2b sub-issue of #56). Adds the assert_output MCP tool — third devagentic-mutation wrapper after silo_query and confer_run.

Workers can now vet a prior tool_call's output against a predicate without shelling out to python api.py.

Schema

Wraps devagentic's:

mutation {
  assertOutput(
    callId: String!,
    expectation: { fragment: String!, predicate: String }
  ) {
    id ts callId passed violations
  }
}

Devagentic-side resolver: /tmp/devagentic_api.py:21363 (verified via gh api).

MCP tool signature

assert_output(call_id: str, fragment: str, predicate: Optional[str] = None) -> str

Returns JSON {id, ts, callId, passed, violations} on success, {"error": "..."} on failure.

Predicate stiffener interop

When predicate is omitted or empty, the wrapper passes None to devagentic — matching the resolver's _stiffen_predicate(tool, None) -> tool-specific floor path. Triggers the kind:predicate-coerced audit doc (devagentic arc-6 telemetry). Both cases (omitted, empty-string) have parametric tests.

Test plan

  • 7 new client-level tests in tests/plugins/devagentic-mutations/test_client.py pass
  • Contract test in tests/test_mcp_defensive_registrars.py extended; assert_output now in required-G2-tools set
  • 182 total tests green across affected suites (mutations + MCP + canvas + docs + subset-filter + autowire) — no regression
  • After merge + container rebuild + devbox HTTP up: assert_output reachable via MCP from a polynomial-explorer worker session

Tracking

Wraps devagentic's ``assertOutput(callId, expectation:
{fragment, predicate?}) -> Verdict`` mutation as an MCP tool.
Workers can now vet a prior tool_call's output against a
predicate without shelling out to ``python api.py``.

## Implementation

- ``plugins/devagentic-mutations/client.py::assert_output(call_id,
  fragment, predicate=None)`` — thin GraphQL wrapper following the
  ``query_silo`` / ``run_confer_loop`` pattern. Returns the verdict
  dict ``{id, ts, callId, passed, violations}`` on success or
  ``None`` on failure (auth, network, ``errors`` payload).

- ``mcp_serve.py::_register_devagentic_mutation_tools`` — adds the
  ``assert_output`` MCP tool. Flat args ``(call_id, fragment,
  predicate=None)``; mapped to the ``ExpectationInput`` GraphQL
  shape internally. Failure path returns ``{"error": "..."}`` JSON
  with the plugin's ``last_error_text()`` surface threaded in.

## Predicate stiffener interop

When ``predicate`` is omitted or empty, the wrapper passes ``None``
to devagentic — explicitly matching the resolver's
``_stiffen_predicate(tool, None) -> tool-specific floor`` path.
This is what triggers the ``kind:predicate-coerced`` telemetry doc
on the devagentic side (arc-6 audit trail). Tested with two
parametric cases: omitted predicate, empty-string predicate.

## Tests

- 7 new client-level tests in tests/plugins/devagentic-mutations/
  test_client.py: empty-arg fail-soft, missing user_id fail-soft,
  happy-path verdict round-trip, predicate-omitted-sends-null,
  empty-predicate-sends-null, null-data fail-soft, non-dict-response
  fail-soft.
- Contract test in tests/test_mcp_defensive_registrars.py extended:
  ``assert_output`` is now in the required-G2-tools set, so a future
  regression that drops the registrar will surface in CI.
- 182 total green across the affected suites (mutations + MCP +
  canvas + docs + subset-filter + autowire). No regression.

## Tracking

- Closes hermes-agent#60 (G2b of #56).
- G2c (#61: patchArtifact / readArtifact) and G2d (#62: fetchUrl)
  remain open as sub-issues.
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.

G2b: assertOutput MCP tool (sub-issue of #56)

1 participant