Repository navigation
Release/1.2.0 - #18
Merged
Merged
Conversation
- key resources/read replay entries by concrete URI - preserve replay compatibility for non-resource methods - add integration coverage for distinct URIs, template instances, and replayed errors - update README, replay authoring docs, and changelog Signed-off-by: Steve Sfartz <stsfartz@cisco.com>
feat: structuredContent in tools/call responses when outputSchema is declared - tools/call now emits structuredContent alongside the backward-compatible content text block whenever the tool declares an outputSchema (MCP spec 2025-06-18). All three data sources are covered: file overrides (--data), example selection, and Faker generation. - FakerGenerator.generate() uses outputSchema to produce schema-shaped data (types, enums, formats, min/max) when declared, replacing the generic success envelope for tools with an output contract. - New public FakerGenerator.generateFromSchema() method for recursive JSON Schema → mock value generation. - Optional --debug validation of structuredContent against outputSchema via Ajv; warns on mismatch without affecting normal operation. - New test fixture: structured-output-server.mcpdesc.json - 7 new integration tests in structured-content.test.ts (Faker + override paths) - Updated docs: README, manual-mocks, authoring-replay-datasets, building-mocks Also promotes the [Unreleased] resources/read URI-aware replay fixes from v1.1.x into the 1.2.0 release entry. Fixes #13 Signed-off-by: Steve Sfartz <stsfartz@cisco.com>
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.
Added
structuredContentintools/callresponses whenoutputSchemais declared.Per MCP spec 2025-06-18, when a tool declares an
outputSchemathe mock nowpopulates
structuredContentwith the resolved JSON payload alongside thebackward-compatible
contenttext block. This applies to all three datasources: file overrides (
--data), example selection, and Faker generation.Hosts and clients that consume the typed
structuredContentpath now receivedata from the mock; text-only consumers are unaffected (no breaking change).
Example response shape for a tool with
outputSchema:{ "content": [{ "type": "text", "text": "{\"sessionId\":\"mock-sessionId-001\",\"state\":\"active\",…}" }], "structuredContent": { "sessionId": "mock-sessionId-001", "state": "active", "totalQuestions": 42, "currentQuestion": 0 } }outputSchema-driven Faker generation.When a tool declares an
outputSchemaand no override or example isavailable, the Faker generator now produces data shaped by that schema
(respecting types, enums, formats, and
minimum/maximumconstraints)rather than the generic success envelope. This gives a correct first-run
experience for any tool with a declared output contract — no
--datadirectory and no recording required.
Optional debug validation of
structuredContentagainstoutputSchema.When
--debugis set, the mock validates the resolved payload against thetool's
outputSchemausing Ajv and logs a warning to stderr if the data doesnot conform. This catches drift between authored fixtures and the declared
output contract at design time without affecting normal operation.
New test fixture
tests/fixtures/mcpdesc/structured-output-server.mcpdesc.json:a dedicated mcpdesc with three tools (
create-session,get-status,list-results) covering objectoutputSchema, nooutputSchema, and arrayoutputSchemarespectively — used by the new integration suite.7 new integration tests in
tests/integration/structured-content.test.tscovering the Faker path andthe
--dataoverride path forstructuredContentemission and backwardcompatibility.
Fixed
resources/readis now URI-aware. Recorded entriesare keyed by concrete resource URI (
resources/read:<uri>), enablingdeterministic per-resource content replay (including template instances).
resources/read. A recordederrorresponse is replayed as an error for the matching resource read,consistent with
tools/callbehavior.Changed
docs/authoring-replay-datasets.mdnow documentsresources/readURI-awarekeys, method-specific argument extraction, and the
structuredContentfieldin hand-authored replay responses.