Repository navigation
Let service methods ask their caller for input - #213
Merged
Merged
Conversation
This was referenced Nov 18, 2026
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 115fc0c | Nov 19 2026, 05:13 PM |
A service method can return an input_required result with form requests and private state. MCP clients on protocol revision 2026-07-28 show the requests as native forms and retry the same call with the answers. A calling app answers with env.SERVICE.withInput(...).method(...). In both cases the provider receives the answers and its state in ctx.props.input. The platform encrypts the provider's state and binds it to the caller, the method and its arguments for 24 hours. Accepted answers must match the requested form.
tnkuehne
force-pushed
the
feat/service-input-requests
branch
2 times, most recently
from
November 19, 2026 17:05
15a2a58 to
fc4a2cd
Compare
The call tool now chooses per request. Clients that declare form elicitation get the native input_required dialog. Other clients that render MCP Apps, including 2025-era clients whose capabilities the stateless gateway cannot see, are pointed to the new ask tool. It shows the question as a form, and the app-only answer tool retries the call with the person's answer. State relayed through the agent is bound to a different channel than the form's state, so the agent cannot answer in the person's place. Argument fingerprints now keep value types apart, accepted answers are checked against string formats, and sealed state fits questions and provider state at their full limits.
Encode argument bytes in chunks so large arrays fit the call argument limit, show date-time defaults in the browser's local time, and keep a failed answer's message visible in the form.
A local time in the hour repeated when daylight saving ends maps to two instants, so the form submits the default itself when the person left it unchanged.
The form is now a Svelte component with the shared UI fields, talks to the host through @modelcontextprotocol/ext-apps instead of hand-written postMessage code, and follows the host's theme. The package build inlines its script and styles into the single HTML resource that MCP hosts load, so no page source lives in strings. The gateway registers the form tools and resource with the ext-apps server helpers.
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.
A service method can now ask the person behind a call to confirm an action or fill in a short form, and continue with the answer. The same method works for MCP clients and for other apps; nothing needs to be imported.
Provider
The method is called again with the same arguments;
ctx.props.inputholds{ inputResponses, requestState }.Callers
call, client with input dialogs (form elicitation declared on the 2026-07-28 request): the gateway returnsinput_requiredwith one form elicitation per request. The client retries the same call withinputResponsesandrequestState, and the gateway calls the method again with the answers.call, other clients that render MCP Apps:calltells the agent to callaskwith the same call and the sealed state.askrendersui://widefleet/input-form.html, a Svelte view built from the shared UI fields on the official MCP Apps client (@modelcontextprotocol/ext-apps, new dependency agreed with the maintainer). The package build inlines its script and styles into that one HTML resource (about 590 KB), because hosts load a view as a single document. The form submits throughanswer, which is app-only (_meta.ui.visibility: ["app"]), retries the method, shows follow-up questions in place, and reports the outcome throughui/update-model-contextandui/messagewhere the host offers them. 2025-era clients take this path because the stateless gateway cannot see their capabilities; some of them render MCP Apps without declaring the extension.callreturns a tool error.execute: the script receives the question as a value. It cannot answer it.env.OFFERS.withInput({ inputResponses, requestState }).send(offerId).withInputis reserved as a service method name.Tested with real clients on a probe server: the native dialog in Claude Code, claude.ai, ChatGPT (Codex-based workspace client) and Codex CLI with its 2026 feature flag; the MCP Apps form plus app-only answer tool in ChatGPT, claude.ai and Microsoft 365 Copilot Cowork (2025-11-25 only). No host offered the app-only tool to the model.
Platform guarantees
requestStateis encrypted with AES-GCM under a key derived from the control token, so callers relay it without reading it.callresult answers only through the client's dialog;askrebinds it for the form without extending its lifetime, and passes it to the view in result_metaonly.answerrefuses state from acallresult.requestState. Sealed state may take up to 64 KiB, enough for both limits at once.askandanswerlike those ofcall.Tests
service-input.test.ts(unit):42nand{ $bigint: "42" }, typed arrays over the same bytes,Mapand entry arrays,NaNandnull,0and-0) do not share state, and a 1 MiB byte argument is matched;app-services-runtime.test.tson workerd and celld (RUN_SERVICE_TESTS=1, 40 passed):input_required→ retry with answers → result with the caller's identity;ask; a 2026 client with neither gets the tool error;askandanswerare listed with the UI resource and app-only visibility, and the form resource is served astext/html;profile=mcp-app;askreturns the form's question in_meta,answercompletes the call, andanswerrefuses the state from thecallresult;withInputand never sees the provider's state;fields.test.ts: form defaults and answers, including a date-time default in the hour repeated when daylight saving ends.pnpm checkpasses.Replaces #200 and #202, whose Workflow-based approach is no longer needed for this.


Confidence Score: 5/5
The reviewed changes appear safe to merge.Summary
Service methods can ask callers for input and resume with checked answers and private saved state. The latest changes replace the handwritten MCP form with shared Svelte fields and the official MCP Apps client.
No new actionable issues were found.
Reviews (9) · Last reviewed commit: "Build the input form as a Svelte view on..." · Reviewed by Greptile