feat(mcp): registerTool + outputSchema/structuredContent for all 5 tools#40
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
P2 #12 from the 2026-05-21 modernization audit.
server.tool()is deprecated in@modelcontextprotocol/sdk1.29.0 in favor ofserver.registerTool({inputSchema, outputSchema, ...}, cb). The new API also unlocksstructuredContent— per MCP 2025-07-09 spec, servers MUST populatestructuredContentwhenoutputSchemais declared, so agents get typed access to tool results instead of re-parsing JSON from text content.Changes
src/mcp-schemas.ts(new, 151 lines)AuditReport,AuditCdReport,AuditSecurityReport— kept asZodRawShapeliterals to match the SDK API.src/index.tsserver.registerTool({...}, cb). Each returns bothcontent(text mirror, backward-compatible) andstructuredContent(typed report).Tools matrix
list_templates{templates: TemplateSummary[]}create_project{path, filesExtracted, filesReplaced, gitInitialized}audit_releaseAuditReportshapeaudit_cdAuditCdReportshapeaudit_securityAuditSecurityReportshapeTest plan
Local stdio smoke verified end-to-end (commits include the test script):
tools/listexposesoutputSchemaon all 5 tools ✓audit_securityon this repo:structuredContent.overall.verdict === "hardened",summary.present === 8(matches the README 8/8 HARDENED claim) ✓audit_release:structuredContent.shipReady.verdictpopulated ✓audit_cd:structuredContent.overall.verdict,destinations[]populated ✓list_templates:structuredContent.templates[]count 11 ✓npm audit --audit-level=moderateexit 0 ✓Risk
structuredContentis purely additive. Tools withoutoutputSchemawould have returned onlycontent; we now return both. Any client that ignoresstructuredContentsees identical behavior.