Skip to content

feat(mcpkit)!: deferred tool registration + Risk/Group primitives (MC-43) - #26

Merged
jgangemi merged 1 commit into
mainfrom
jae/mc43-deferred-registration
Jul 12, 2026
Merged

jgangemi merged 1 commit into
mainfrom
jae/mc43-deferred-registration

Conversation

@jgangemi

Copy link
Copy Markdown
Member
  • add mcpkit.Risk (ReadOnly/Write/Destructive), a required positional AddTool param that fail-closes on unannotated write/destructive tools
  • auto-derive ToolAnnotations from Risk via mcpx.RiskAnnotations (MC-42) when the caller left Annotations nil; an explicit Annotations still wins
  • add mcpkit.Group(name) ToolOption, arbitrary per-tool bookkeeping consumed by the registry's byGroup map
  • defer tool registration out of AddTool into an unexported registry of pendingTool closures; App.finalize (called once, idempotently, from Run/Connect/HTTPHandler) registers every pending tool against the live mcpx.Server
  • this is the load-bearing MC-43 step of the MC-40 tier/gate epic: it introduces the deferred-registration seam a later gate (MC-44) will filter before anything registers, but MC-43 itself is behavior-preserving -- every tool still ends up registered, just at Run/Connect/HTTPHandler time instead of at New
  • update every AddTool caller (mcpkit_test.go, testkit/harness_test.go, examples/server, examples/minimal, examples/http) to pass an explicit Risk; all are ReadOnly query/demo tools

BREAKING CHANGE: AddTool now requires a Risk argument and registers tools at Run/Connect/HTTPHandler instead of at New.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

…-43)

- add mcpkit.Risk (ReadOnly/Write/Destructive), a required positional AddTool param that fail-closes on unannotated write/destructive tools
- auto-derive ToolAnnotations from Risk via mcpx.RiskAnnotations (MC-42) when the caller left Annotations nil; an explicit Annotations still wins
- add mcpkit.Group(name) ToolOption, arbitrary per-tool bookkeeping consumed by the registry's byGroup map
- defer tool registration out of AddTool into an unexported registry of pendingTool closures; App.finalize (called once, idempotently, from Run/Connect/HTTPHandler) registers every pending tool against the live mcpx.Server
- this is the load-bearing MC-43 step of the MC-40 tier/gate epic: it introduces the deferred-registration seam a later gate (MC-44) will filter before anything registers, but MC-43 itself is behavior-preserving -- every tool still ends up registered, just at Run/Connect/HTTPHandler time instead of at New
- update every AddTool caller (mcpkit_test.go, testkit/harness_test.go, examples/server, examples/minimal, examples/http) to pass an explicit Risk; all are ReadOnly query/demo tools

BREAKING CHANGE: AddTool now requires a Risk argument and registers tools at Run/Connect/HTTPHandler instead of at New.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jgangemi
jgangemi enabled auto-merge (squash) July 12, 2026 19:41
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29206278140

Coverage increased (+0.07%) to 95.934%

Details

  • Coverage increased (+0.07%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (50 of 51 lines covered, 98.04%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
mcpkit.go 51 50 98.04%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1402
Covered Lines: 1345
Line Coverage: 95.93%
Coverage Strength: 1.11 hits per line

💛 - Coveralls

@jgangemi
jgangemi merged commit 7be7b7c into main Jul 12, 2026
4 checks passed
@jgangemi
jgangemi deleted the jae/mc43-deferred-registration branch July 12, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants