Skip to content

feat(mcp): registerTool + outputSchema/structuredContent for all 5 tools#40

Merged
heznpc merged 1 commit into
mainfrom
feat/mcp-output-schemas
May 20, 2026
Merged

feat(mcp): registerTool + outputSchema/structuredContent for all 5 tools#40
heznpc merged 1 commit into
mainfrom
feat/mcp-output-schemas

Conversation

@heznpc
Copy link
Copy Markdown
Member

@heznpc heznpc commented May 20, 2026

Summary

P2 #12 from the 2026-05-21 modernization audit.

server.tool() is deprecated in @modelcontextprotocol/sdk 1.29.0 in favor of server.registerTool({inputSchema, outputSchema, ...}, cb). The new API also unlocks structuredContent — per MCP 2025-07-09 spec, servers MUST populate structuredContent when outputSchema is declared, so agents get typed access to tool results instead of re-parsing JSON from text content.

Changes

File Change
src/mcp-schemas.ts (new, 151 lines) Zod schemas mirroring AuditReport, AuditCdReport, AuditSecurityReport — kept as ZodRawShape literals to match the SDK API.
src/index.ts All 5 tools migrated to server.registerTool({...}, cb). Each returns both content (text mirror, backward-compatible) and structuredContent (typed report).

Tools matrix

Tool Input schema Output schema
list_templates none {templates: TemplateSummary[]}
create_project template, name, description, output_dir, init_git {path, filesExtracted, filesReplaced, gitInitialized}
audit_release optional path full AuditReport shape
audit_cd optional path full AuditCdReport shape
audit_security optional path full AuditSecurityReport shape

Test plan

Local stdio smoke verified end-to-end (commits include the test script):

  • tools/list exposes outputSchema on all 5 tools ✓
  • audit_security on this repo: structuredContent.overall.verdict === "hardened", summary.present === 8 (matches the README 8/8 HARDENED claim) ✓
  • audit_release: structuredContent.shipReady.verdict populated ✓
  • audit_cd: structuredContent.overall.verdict, destinations[] populated ✓
  • list_templates: structuredContent.templates[] count 11 ✓
  • 85/85 unit tests pass ✓
  • npm audit --audit-level=moderate exit 0 ✓

Risk

  • Low. Text content is unchanged (the existing surface clients depend on). structuredContent is purely additive. Tools without outputSchema would have returned only content; we now return both. Any client that ignores structuredContent sees identical behavior.

…nt for all 5 tools

P2 #12 from the 2026-05-21 modernization audit.

server.tool() is deprecated in @modelcontextprotocol/sdk 1.29.0 in favor of
server.registerTool({inputSchema, outputSchema, ...}, cb). The new API also
unlocks structuredContent — per MCP 2025-07-09 spec, servers MUST populate
structuredContent when outputSchema is declared, so clients get typed access
to tool results instead of re-parsing JSON from text content.

Changes:

- src/mcp-schemas.ts (new, 151 lines): zod schemas mirroring AuditReport,
  AuditCdReport, AuditSecurityReport. Kept as ZodRawShape literals matching
  the McpServer.registerTool API.

- src/index.ts: all 5 tools migrated from server.tool() to
  server.registerTool({...}, cb):
  * list_templates: outputSchema {templates: TemplateSummary[]}
  * create_project: outputSchema {path, filesExtracted, filesReplaced, gitInitialized}
  * audit_release / audit_cd / audit_security: outputSchema mirrors the
    respective TS interface.

- Each tool now returns both 'content' (text mirror) and 'structuredContent'
  (the typed report object). Text remains the human-readable surface;
  structuredContent gives agents typed access.

Verified end-to-end via stdio smoke:
- tools/list now shows outputSchema on all 5 tools
- audit_security on this repo: structured verdict=hardened, present=8/8
- audit_release: structured shipReady.verdict
- audit_cd: structured overall.verdict + destinations[]
- list_templates: structured templates[] (count 11)

All 85 unit tests still pass.
@heznpc heznpc merged commit 98a2822 into main May 20, 2026
4 checks passed
@heznpc heznpc deleted the feat/mcp-output-schemas branch May 20, 2026 23:30
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.

1 participant