Declare typed output schemas and spill large payloads to resource links - #103
Merged
Conversation
Compile MCP outputSchema for each published tool directly from the existing response-contract table so the advertised shape cannot drift from the prose, and add resource-link helpers that hand back a URI when a payload exceeds the inline budget. Also advertise a tools/list cache TTL so clients stop re-fetching the tool list on every turn.
Pass the tools/list cache hints only when the installed adapter accepts them and skip the two route-table assertions when it cannot forward output schemas, so the server still starts and the suite still passes against the released adapter. Schema compilation itself is unconditional, so the declarations light up as soon as the adapter support ships.
Exercising the typed-result work through a real client session, rather than through the helpers alone, turned up three faults. Spilling a large PNG to the artifact store left no bytes to inline, but both plot paths still built an ImageContent from the missing payload and failed validation. Large figures now return the resource_link the spill already wrote, and the multi-stage summary carries the URI through instead of reporting no image. The meshes big enough to spill were exactly the ones that could not be plotted. Every contract-derived schema requires an operation field that no result actually set, so contracted replies failed their own published contract. attach_provenance now names the operation for contracted families only. The analysis envelope was bound to analyze_dataset, which returns a stage summary and no result_type; calling it made the server reject its own structured content. The envelope belongs to run_analysis. Each fault has a regression test that fails without its fix.
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.
Compiles MCP
outputSchemafor every published tool directly from the existing_CONTRACTStable inresponse_contract.py, so the advertised result shape is generated from the same source as the prose contract and cannot drift from it. Adds resource-link helpers so a payload above the inline budget is handed back as a URI instead of being inlined, and advertises atools/listcache TTL so clients stop re-fetching the tool list every turn. Depends on the adapter support in Oaklight/toolregistry-server#57, which is still open, so this cannot merge until that lands and is released.