Skip to content

feat(mcp): add OpenAPI introspection read tools - #1204

Merged
rickylabs merged 6 commits into
mainfrom
feat/openapi-mcp-read-tools
Aug 4, 2026
Merged

feat(mcp): add OpenAPI introspection read tools#1204
rickylabs merged 6 commits into
mainfrom
feat/openapi-mcp-read-tools

Conversation

@rickylabs

@rickylabs rickylabs commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

Add the three OpenAPI introspection read tools by composing the existing endpoint directory and pure OpenAPI projection surfaces.

Closes #1132

Scope

Slices

  • Harness research, plan, and Design checkpoint — 2d0967244
  • Contracts, flows, and acceptance fixtures
  • Registry, composition, receipts, exports, and documentation synchronization
  • Full package, doctrine, JSR, and close-gate evidence

Validation

  • Targeted acceptance/registry/stdio fixtures: PASS
  • Full packages/mcp tests: PASS — 98/98
  • Scoped check/lint/fmt wrappers: PASS — 92 files, zero findings
  • quality:gate: PASS
  • Package doc-lint: PASS — zero findings
  • Package publish dry-run and publish-asset check: PASS
  • Real CLI stdio smoke: PASS — 1/1
  • Opposite-family Claude review: PASS; three low findings incorporated
  • OpenHands composed evaluator dispatched; orchestrator pre-merge gate remains merge authority

Harness

  • Run dir: .llm/runs/feat-openapi-mcp-read-tools--s6/
  • PLAN-EVAL: composed per milestone-run.md (orchestrator waiver)
  • IMPL-EVAL: composed per milestone-run.md (orchestrator waiver)

Drift / Debt

  • Live remote registry is 14, so the truthful delta is 14→17; staged 17→20 was re-baselined as stale.
  • No architecture debt accepted.

Definition of Done

  • Fixtures prove truncated: true iff rows were dropped.
  • Fixtures prove operation count is absent, not zero, when no spec was fetched.
  • Fixtures prove S5's sources block surfaces verbatim.
  • Three read tools are registered, composed, and receipt-wrapped.
  • Archetype-2 package gates, doc-lint, and publish dry-run pass.
  • No new lint ignores or deno.lock churn.
  • Composed evaluation and orchestrator pre-merge handoff are recorded.
issue: 1132
entries:
  - box: "gate: fixtures prove `truncated: true` appears whenever any row was dropped, and never coexists with removed rows"
    evidence: "packages/mcp/tests/openapi-read-tools_test.ts proves service and operation caps report truncation exactly when matching rows are dropped."
  - box: "gate: operations count absent (not zero) when no spec was fetched"
    evidence: "packages/mcp/tests/openapi-read-tools_test.ts proves operationCount is omitted for a service row without a fetched spec."
  - box: "gate: sources block from S5 surfaces verbatim in `list_api_services` output"
    evidence: "packages/mcp/tests/openapi-read-tools_test.ts proves strict reference equality between the S5 sources block and tool output."

@rickylabs rickylabs added this to the 0.0.5 milestone Aug 4, 2026 — with ChatGPT Codex Connector
@rickylabs rickylabs added area:tooling type:feat status:plan Harness plan phase priority:p1 High epic:openapi-mcp OpenAPI→MCP service introspection epic (RFC #1123, tracking #1117) labels Aug 4, 2026 — with ChatGPT Codex Connector

Copy link
Copy Markdown
Owner Author

[PHASE: IMPL]

S6 implementation slice landed at 076bf50e1.

Scope

  • Three contract-first read flows compose S4 projection + S5 endpoint directory.
  • Both service and operation arrays self-cap at 49 with honest truncated metadata.
  • Operation count is omitted unless a parsed spec exists.
  • S5 sources is forwarded verbatim.
  • CLI wiring uses S8 post-validation receipt settlement.
  • Live registry moves truthfully from 14 to 17.

Evidence

  • Targeted acceptance/registry/stdio fixtures: 10/10 PASS.
  • Full packages/mcp suite: 98/98 PASS.
  • Scoped check: 92 files, 0 diagnostics.
  • Scoped lint/fmt with package config: 92 files, 0 findings.
  • deno task quality:gate: PASS.
  • deno task doc:lint --root packages/mcp --pretty: combined total 0.
  • Package publish dry-run: PASS.
  • No deno.lock churn and no new lint ignores.

Next

  • Opposite-family code review, then milestone-composed augment/OpenHands/orchestrator handoff.

@rickylabs

Copy link
Copy Markdown
Owner Author

@openhands-agent model=qwen/qwen3.7-max provider=openrouter effort=high output=pr-comment

use harness

Review PR 1204 as the OpenHands component of the milestone-run composed evaluator protocol. This is
review-only: do not modify source, run artifacts, deno.lock, or any file; do not commit or push.

SKILL

  • netscript-harness — read the run artifacts and honor the milestone evaluator waiver.
  • netscript-doctrine — evaluate packages/mcp against Archetype 2.
  • jsr-audit — verify the public export and publish evidence.
  • netscript-tools — use authoritative gates and preserve lock hygiene.
  • netscript-pr — report a structured REVIEW verdict without changing PR metadata.
  • openhands-handoff — write the required OpenHands summary output.

Review scope

Read issue 1132, RFC 1123, the full diff from main, and
.llm/runs/feat-openapi-mcp-read-tools--s6/. Verify:

  1. truncated: true iff service or operation rows were actually dropped; no central silent cap.
  2. operationCount is absent, not zero, whenever no parsed spec was fetched.
  3. S5's sources block is surfaced verbatim.
  4. All three tools compose S4 projection and S5 directory rather than re-deriving either.
  5. Receipts use S8 post-output-validation settlement.
  6. Registry moves from the live 14 baseline to 17, contracts/exports/docs agree, and no unrelated
    tool is invented.
  7. No new lint ignores, unsafe casts, lock churn, speculative abstractions, or out-of-scope live
    scaffold/AppHost work.

Run the smallest checks needed to verify claims. Report PASS or actionable findings with severity
and file:line evidence. Include raw exit codes for any commands run. Write the required
OPENHANDS_SUMMARY_PATH; do not trust or reuse a stale persistent summary.


OUTPUT CONTRACT (mandatory — verdict first)

  1. Post the verdict PR comment IMMEDIATELY after you form the verdict — BEFORE any
    optional deep-dive, extra verification, or long context dump. Iteration budgets
    exhaust; a verdict comment deferred to the end of the run is frequently lost.
  2. That PR comment MUST start with the formal header line, exactly:
    [PHASE: ] [VERDICT: ]
    where is your eval phase (e.g. IMPL-EVAL, PLAN-EVAL) and is one
    of PASS, FAIL_FIX, FAIL_RESCOPE, FAIL_DEBT, FAIL_PLAN.
  3. ALWAYS end BOTH the verdict PR comment AND your summary file with one final
    machine-readable line of the exact form:
    OPENHANDS_VERDICT:
    using a literal token from: PASS, FAIL_FIX, FAIL_RESCOPE, FAIL_DEBT, FAIL_PLAN,
    NONE. Use NONE only when no verdict could be reached.

@rickylabs

rickylabs commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

OpenHands Agent — Agent failed

OPENHANDS_VERDICT: NONE

Model: qwen/qwen3.7-max
Provider: OPENROUTER
Job status: failure
Verdict source: none
Summary source: none
Housekeeping: ack=success trace=success commit-artifacts=success replies=skipped draft-pr=skipped
Commit-back skipped 1 non-allow-listed path(s) (never pushed; see uncommitted.txt/uncommitted.patch in the Actions artifact): deno.lock
Trace: .llm/tmp/run/openhands/pr-1204/run-30888468552-1 (in the Actions artifact)
Artifact: openhands-agent-30888468552-1

OpenHands Agent Summary

The agent run failed before producing a summary.

This is a workflow failure, not a task verdict.

Diagnostics

See the uploaded Actions artifact for bootstrap.log and agent.log when present.

Run: https://github.com/rickylabs/netscript/actions/runs/30888468552

@rickylabs

Copy link
Copy Markdown
Owner Author

@openhands-agent model=openrouter/qwen/qwen3.7-max provider=openrouter effort=high output=pr-comment

use harness

Review PR 1204 as the OpenHands component of the milestone-run composed evaluator protocol. This is
review-only: do not modify source, run artifacts, deno.lock, or any file; do not commit or push.

SKILL

  • netscript-harness — read the run artifacts and honor the milestone evaluator waiver.
  • netscript-doctrine — evaluate packages/mcp against Archetype 2.
  • jsr-audit — verify the public export and publish evidence.
  • netscript-tools — use authoritative gates and preserve lock hygiene.
  • netscript-pr — report a structured REVIEW verdict without changing PR metadata.
  • openhands-handoff — write the required OpenHands summary output.

Review scope

Read issue 1132, RFC 1123, the full diff from main, and
.llm/runs/feat-openapi-mcp-read-tools--s6/. Verify:

  1. truncated: true iff service or operation rows were actually dropped; no central silent cap.
  2. operationCount is absent, not zero, whenever no parsed spec was fetched.
  3. S5's sources block is surfaced verbatim.
  4. All three tools compose S4 projection and S5 directory rather than re-deriving either.
  5. Receipts use S8 post-output-validation settlement.
  6. Registry moves from the live 14 baseline to 17, contracts/exports/docs agree, and no unrelated
    tool is invented.
  7. No new lint ignores, unsafe casts, lock churn, speculative abstractions, or out-of-scope live
    scaffold/AppHost work.

Run the smallest checks needed to verify claims. Report PASS or actionable findings with severity
and file:line evidence. Include raw exit codes for any commands run. Write the required
OPENHANDS_SUMMARY_PATH; do not trust or reuse a stale persistent summary.


OUTPUT CONTRACT (mandatory — verdict first)

  1. Post the verdict PR comment IMMEDIATELY after you form the verdict — BEFORE any
    optional deep-dive, extra verification, or long context dump. Iteration budgets
    exhaust; a verdict comment deferred to the end of the run is frequently lost.
  2. That PR comment MUST start with the formal header line, exactly:
    [PHASE: ] [VERDICT: ]
    where is your eval phase (e.g. IMPL-EVAL, PLAN-EVAL) and is one
    of PASS, FAIL_FIX, FAIL_RESCOPE, FAIL_DEBT, FAIL_PLAN.
  3. ALWAYS end BOTH the verdict PR comment AND your summary file with one final
    machine-readable line of the exact form:
    OPENHANDS_VERDICT:
    using a literal token from: PASS, FAIL_FIX, FAIL_RESCOPE, FAIL_DEBT, FAIL_PLAN,
    NONE. Use NONE only when no verdict could be reached.

@rickylabs

rickylabs commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

OpenHands Agent — Completed

OPENHANDS_VERDICT: PASS

Model: openrouter/qwen/qwen3.7-max
Provider: OPENROUTER
Job status: success
Verdict source: summary-file
Verdict comment: #1204 (comment)
Summary source: agent
Housekeeping: ack=success trace=success commit-artifacts=success replies=skipped draft-pr=skipped
Trace: .llm/tmp/run/openhands/pr-1204/run-30891416446-1 (in the Actions artifact)
Artifact: openhands-agent-30891416446-1

IMPL-EVAL Summary for PR #1204

Phase: IMPL-EVAL
Verdict: PASS
PR: feat(mcp): add OpenAPI introspection read tools (#1204)
Issue: Add OpenAPI introspection read tools to MCP server (#1132)
RFC: OpenAPI read tools design (RFC #1123)

Verification Results

1. Truncation Logic

  • PASS: truncated: true iff service or operation rows were actually dropped
  • Evidence:
    • list-api-services-flow.ts:54 uses entries.length > API_SERVICE_RESULT_LIMIT
    • list-service-operations-flow.ts:80 uses operations.length > limit
    • No central silent cap; explicit row-drop detection

2. operationCount Absence

  • PASS: operationCount is absent (not zero) when no parsed spec was fetched
  • Evidence:
    • list-api-services-flow.ts:66-69 uses conditional spread: ...(row.status === running ? { operationCount } : {})
    • Property omitted entirely when service is not running

3. S5 Sources Block

  • PASS: S5 sources block is surfaced verbatim
  • Evidence:
    • list-api-services-flow.ts:52 returns sources: result.sources
    • No transformation, direct forwarding

4. S4/S5 Composition

  • PASS: All three tools compose S4 projection and S5 directory
  • Evidence:
    • list_api_services: uses directory.list() (S5) and indexOpenApiOperations() (S4)
    • list_service_operations: uses directory.list() (S5) and indexOpenApiOperations() (S4)
    • get_operation_schema: uses directory.list() (S5), indexOpenApiOperations() (S4), and projectOperationSchemaViews() (S4)
    • No re-derivation of projection or directory

5. S8 Receipt Settlement

  • PASS: Receipts use S8 post-output-validation settlement
  • Evidence:
    • Test verifies receipt fields: command, resource, exitStatus

6. Registry Count 14 to 17

  • PASS: Registry moves from 14 to 17, contracts/exports/docs agree
  • Evidence:
    • registry_test.ts expects tools.length === 17
    • stdio_test.ts expects result.tools.length === 17
    • agent-mcp-stdio_test.ts expects result.tools.length === 17
    • README.md updated to 17 token-bounded tools
    • reference/mcp/index.md updated to 17 tools
    • agent-tooling.md updated to Seventeen tools
    • Only three new tools added: list_api_services, list_service_operations, get_operation_schema
    • No unrelated tool invented

7. Code Quality

  • PASS: No new lint ignores, unsafe casts, lock churn, speculative abstractions
  • Evidence:
    • deno lint exit code: 0
    • No deno-lint-ignore in new files
    • No as any or as unknown in new files
    • deno.lock unchanged
    • No speculative abstractions; flows are minimal and focused
    • No out-of-scope live scaffold or AppHost work

Test Results

MCP Package Tests

  • ok | 98 passed | 0 failed (2s)
  • Exit code: 0

Lint Results

  • Checked 8 files
  • Exit code: 0

Architecture Compliance

Archetype 2: Application flows composed from domain operations and ports
Compliance: Full compliance

  • Flows compose S4 (OpenAPI projection) and S5 (service directory)
  • No re-derivation or duplication
  • Fixture-only tests (no live scaffold)
  • Bounded outputs with explicit truncation
  • Receipt settlement via S8

Implementation Quality

Strengths:

  • Minimal, focused flows (1288 lines total)
  • Conditional property spreads for optional fields
  • Explicit error codes (service_unknown, operation_unknown)
  • S4 description ladder integration
  • Canonical operation resolution with suggestion fallback
  • Comprehensive test coverage (5 tests)

No Issues Found:

  • No code duplication
  • No speculative abstractions
  • No unsafe casts
  • No lint violations
  • No lock file changes

Documentation Sync

Updated Files:

  • README.md: 17 token-bounded tools
  • reference/mcp/index.md: 17 tools, added 3 new tool rows
  • agent-tooling.md: Seventeen tools, added Inspect service APIs section

Coverage: Complete and accurate

Risk Assessment

Risk Level: Low
Remaining Risks: None identified

Commands Executed

  1. deno task test packages/mcp/ - exit code: 0
  2. deno lint packages/mcp/src/application/flows/ packages/mcp/src/domain/openapi/ packages/mcp/tests/openapi-read-tools_test.ts - exit code: 0
  3. git log -1 - exit code: 0
  4. git show (source files) - exit code: 0
  5. git diff origin/main...HEAD (tests, docs) - exit code: 0

Conclusion

PR #1204 fully implements the OpenAPI introspection read tools as specified in RFC #1123 and issue #1132. All 7 acceptance criteria pass. The implementation is architecturally sound (Archetype 2), follows S4/S5 composition patterns, uses S8 receipt settlement, and maintains code quality standards. Test coverage is comprehensive, lint is clean, and documentation is synced.

Verdict: PASS

OPENHANDS_VERDICT: PASS

Run: https://github.com/rickylabs/netscript/actions/runs/30891416446

@rickylabs rickylabs added status:impl-eval and removed status:plan Harness plan phase labels Aug 4, 2026
@rickylabs
rickylabs marked this pull request as ready for review August 4, 2026 08:23
@rickylabs

Copy link
Copy Markdown
Owner Author

[PHASE: IMPL-EVAL] [VERDICT: PASS]

Composed Evaluation Summary

Acceptance Criteria Verification

  1. Truncation logictruncated: true iff rows were actually dropped; no central silent cap. Self-caps at 49, below central 50-row truncator. Tests verify exact behavior.
  2. operationCount absence — absent, not zero, when no parsed spec was fetched. Conditional spread at list-api-services-flow.ts:66-67. Test verifies property not present.
  3. S5 sources forwarding — verbatim, no transformation. list-api-services-flow.ts:52 forwards result.sources. Test asserts reference equality.
  4. S4/S5 composition — all three tools compose S4 projection (indexOpenApiOperations, projectOperationSchemaViews) and S5 directory (directory.list()).
  5. S8 receipts — post-output-validation settlement. Test verifies command, resource, exitStatus fields.
  6. Registry 14→17 — registry_test.ts, stdio_test.ts, agent-mcp-stdio_test.ts all assert 17. Docs updated. Only the 3 S6 tools added.
  7. No debt — lint clean (exit 0), no lint ignores or unsafe casts in new code, deno.lock unchanged, all 98 MCP tests pass.

Validation Evidence

deno task test packages/mcp/
ok | 98 passed | 0 failed (2s)
exit code: 0

deno lint packages/mcp/src/application/flows/ packages/mcp/src/domain/openapi/ packages/mcp/tests/openapi-read-tools_test.ts
Checked 8 files
exit code: 0

Architecture Compliance

  • Archetype 2: Application flows composed from domain operations and ports
  • Fixture-only: All tests use mock directory ports, no live scaffold
  • Bounded outputs: Self-caps at 49 rows, explicit truncation metadata
  • Receipt settlement: S8 lifecycle verified in CLI test

Implementation Quality

  • Minimal, focused flows with no speculative abstractions
  • Conditional property spreads, no unsafe casts
  • Explicit error codes (service_unknown, operation_ambiguous)
  • S4 description ladder integration
  • Canonical operation resolution with suggestion fallback

Documentation Sync

  • README.md: 17 token-bounded tools
  • reference/mcp/index.md: 17 tools, 3 new tool rows
  • agent-tooling.md: Seventeen tools, Inspect service APIs section

OPENHANDS_VERDICT: PASS

@rickylabs

Copy link
Copy Markdown
Owner Author

[PHASE: REVIEW] [VERDICT: PASS]

Opposite-family Claude Fable review passed. Three low-severity findings were accepted before handoff: error suggestions are bounded, the public limit contract remains the shared 1–100 schema while flows self-cap at 49, and the receipt fixture name now matches its success-path assertion.

OpenHands composed IMPL-EVAL also returned PASS in comment 5176464319. Orchestrator pre-merge authority is retained per milestone-run.md.

@rickylabs
rickylabs deleted the feat/openapi-mcp-read-tools branch August 13, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tooling canary:0.0.5-canary.5 Published NetScript prerelease 0.0.5-canary.5 epic:openapi-mcp OpenAPI→MCP service introspection epic (RFC #1123, tracking #1117) priority:p1 High status:impl-eval type:feat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[openapi-mcp S6] Three read tools: contracts, flows, registry wiring, receipts

1 participant