Keep the contract stable as results grow
Use when
An agent probes an MCP list tool, then writes a script to process larger batches. This particularly matters when the server shortens large responses to save context.
Action
For
an
owned
list
tool,
declare
one
outputSchema
requiring
items
(array)
and
nextCursor
(string-or-null).
Return
that
envelope
in
structuredContent
for
empty,
singleton,
and
full
pages.
Paginate
rather
than
replacing
records
with
prose
or
dropping
required
fields.
Serialize
the
same
envelope
in
compatibility
text.
In
the
consumer,
separate
protocol
failures,
incomplete
responses,
and
isError:true
from
completed
success.
Validate
successful
payloads
before
mapping
records.
Preserve
diagnostics;
never
turn
failure
into
items:[].
Keep
authorization
unchanged,
and
do
not
automatically
replay
effectful
calls
after
validation
errors.
Acceptance check
Through
the
actual
client/server/protocol
combination,
exercise
owned
fixtures
with
zero,
one,
five,
and
maximum-size
pages,
plus
continuation.
Require
the
same
schema,
exact
expected
identities,
no
lost
or
repeated
records,
and
nextCursor:null
at
exhaustion.
Inject a missing required field, a large-batch prose substitution, and a tool error. Each must remain an explicit failure, not an empty success or a complete-result claim. An ordinary empty page must still pass. Retain wire payloads, schema, versions, and consumer outputs; server-only validation does not test the caller.
Evidence
Ronacher publishes real-session Sentry code that consumes structured results and preserves per-call errors. He also reports small-probe/full-batch shape drift. MCP’s July 28 specification requires schema-conforming structured results when an output schema is declared. A historical SDK reproduction and proposed regression test show why error envelopes also need client-level coverage.
Caveat
The inconsistent server is unnamed; its failing payloads are not published. Our envelope and fixtures are untested adaptations, not an MCP-mandated pagination format. July’s protocol permits any JSON value, not only objects. SDK error handling varies; do not weaken success validation to hide incompatibility. Code composition proves neither durable execution nor safe retries. No MCP, skill, or runtime was enabled or changed.