What an app inside ChatGPT taught me about tool design
In a chat host, a model decides whether your app runs and sees only part of what you return. Design every tool for that reader.
I built the app inside ChatGPT for the product I work on at Intuit: an MCP server, OAuth against accounts customers already had, and an embedded UI.
None of that is new. MCP runs on JSON-RPC, OAuth dates to 2007, and the UI is an iframe. The new part was who reads it first. My first instincts were for a developer reading docs or a user clicking buttons. In a chat host the first reader is a model, and it reads your tool list, your descriptions and your results differently from either.
The examples below use a made-up store with orders, refunds and a support agent.
The model decides whether you run
In a normal integration the user clicks your button. In ChatGPT the user types a sentence and the model decides which app, if any, gets the call. Your tool name, description and input schema are the routing table. OpenAI’s own guide on optimizing metadata says this directly and tells you to build a set of test prompts, including ones that should not trigger your app.
That last part is the one people skip. A description that says only what a tool does invites two failures. The model calls you for requests that belong to some other app, and it picks the wrong one of your own tools when two sound alike.
Compare these:
get_order: Get an order.
get_order: Look up one order the signed-in customer already
placed, by order number or by date. Use for "where is my order"
and "what did I buy". Do not use for items still in the cart;
use get_cart.
The second costs forty more tokens on every request where the tool list is loaded. It’s worth it, because a wrong route costs a full round trip plus a confused answer, and the user sees both. Write descriptions the way you’d write the when clause of a router, then keep a file of prompts that should and shouldn’t hit each tool and rerun it whenever a description changes. A one-word edit to one description can steal traffic from another tool, and only rerunning the prompts will catch it.
One result, three channels
A tool result in the Apps SDK has three parts, and each has a different audience:
structuredContentgoes to the model and to your component.contentis text for the model, and for MCP clients that don’t render anything._metagoes to the component only. The model never sees it.
The obvious move is to put everything the UI needs in _meta so the model’s context stays small. Here is the bug that invites. The component shows a list of five orders. The user types “refund the second one.” The model never saw the list. It saw a one-line summary, so it either asks which order the user meant, which looks broken, or it guesses, which is worse.
The rule I’d use now: anything the user might refer to in their next message goes in structuredContent, with stable IDs and in the same order the UI shows it. _meta is for things nobody will talk about, like image URLs, layout hints, and pagination cursors. Token budget matters less than keeping the model’s picture of the screen identical to the user’s.
That rule holds only while the component sits still. Once the user sorts or pages the list, the screen and the last tool result disagree, and “the second one” points at a different order than the user is looking at. That’s worse than the _meta bug, because the model now answers confidently. The component has to report its view back. Persist the sort order and the selection through widget state after every meaningful interaction. Check how much of that state your host shows the model, and send a short follow-up message if it shows none. Keep IDs fixed across re-renders so “the second one” always maps to the same order.
Return what the model needs for its next decision
A REST endpoint returns the resource. A tool should return the resource plus whatever the model needs to choose its next step. Anthropic’s post on writing tools for agents makes the same argument: return meaningful context, prefer human-readable identifiers to opaque UUIDs, and make errors say what to do.
Errors matter most here. An HTTP 400 with refund_not_allowed is fine for a developer, who can look up what it means. A model has only the response. Compare:
{ "error": "refund_not_allowed" }
{
"error": "refund_window_closed",
"message": "Order A-1001 was delivered on Dec 2. Refunds close
30 days after delivery. Tell the customer, and ask whether
they want store credit."
}
The second error turns a dead end into a correct next step. An instruction in the error sits at the end of the context, right where the model makes its next choice. A rule in a long system prompt is far behind it.
The tempting version of that message says “issue store credit with create_store_credit instead.” A model will follow it, which means an error message can launch a write the user never asked for. Errors may point at reads, or tell the model to ask the user. They shouldn’t prescribe a write.
Fewer, bigger tools
Each tool call in a chat host is visible latency. The user watches the spinner. Three chatty calls (list_orders, then get_order, then get_refund_policy) feel slow even when each is fast. One find_order that takes a natural description and returns the order with its refund eligibility already computed is faster and harder for the model to misuse.
The counter-pressure is that a tool doing too much needs a long, branching description, and long descriptions route worse. My test: if the description needs the word “or” to explain what the tool does, it’s two tools. If it needs “or” only to explain how the user might ask, it’s one.
Annotations are a contract with the host
MCP tools carry annotations such as readOnlyHint and destructiveHint. The Apps SDK reference says destructiveHint tells the host to get explicit approval from the user first. You don’t control the confirmation UX. The host does, based on what you declared.
Read the defaults before you skip them. A tool with no annotations is readOnlyHint: false, destructiveHint: true, openWorldHint: true. In other words, an unannotated get_order looks to the host like a destructive write that reaches the outside world. Leave your reads unannotated and users see a confirmation prompt on every lookup and learn to approve without reading. That habit is still there when the real refund prompt shows up. Annotate every read as read-only, mark additive writes destructiveHint: false, and save the destructive flag for the calls that deserve the friction.
None of this is a security boundary. The spec tells clients not to trust annotations from untrusted servers. Your server shouldn’t trust the model either: authorize every call on the server.
Auth comes first, and it is someone else’s client
The user arrives from ChatGPT and has to link an account they already have. The MCP authorization spec makes your server an OAuth 2.1 resource server, and ChatGPT is the client. That client registers itself with your authorization server, through a client metadata document or dynamic registration, so allow-listing known client IDs doesn’t work the way it does for a partner integration. You never see the user’s ChatGPT identity. You see a token. Validate its audience so a token minted for some other server can’t be replayed against yours. Don’t forward it downstream either. The spec forbids token passthrough, so your internal services get a token your server mints.
Registration is where the consent screen gets dangerous. With open dynamic registration, anyone can register a client called “ChatGPT” and send your users a link to your real consent page. A client ID metadata document ties the client ID to an HTTPS URL you can show on that page, which is a large part of why the spec now prefers it. Put the client’s domain on the consent page next to its display name.
Then scope. The consent screen is the one moment the user reads what the app can do. Ask for the narrowest scopes the read tools need. When a write needs more, the spec’s step-up flow has the server answer with a 403 and an insufficient_scope challenge so the client can send the user back through consent. Check that your host supports it before you design around it.
Start auth on day one. Everything else can run against a stubbed user while the real flow is built. At any company that holds customer data, an OAuth integration goes through security review, and that review runs on its own clock.
The component calls tools too
The embedded UI runs in a sandboxed iframe and can call your tools directly through the host bridge, with no model in the loop. That’s useful: a “refund” button doesn’t need a round trip through the model. It’s also the second way the two pictures drift apart. A refund the component issued never entered the model’s context, so when the user asks “did that go through?” the model answers from what it last saw, which no longer matches the account. Every write the component makes has to be reported back into the conversation, through widget state or a follow-up message. Expose to the component only the tools it needs, and authorize those calls on the server like any other.
Keep the component small. The user navigates by typing, so menus and tab bars are dead weight. Show one result well and offer the one action the user most likely wants next.
The server is the product, the UI is an adapter
Design as if ChatGPT is the first host of several. MCP is the shared layer, so the tools and the auth flow shouldn’t need to know which host is calling. The UI is the part that doesn’t port cleanly, since each host has its own metadata and rendering conventions. In late January the MCP maintainers shipped MCP Apps, the first official MCP extension, for interactive UI. Claude and ChatGPT both support it, which should shrink that gap. Until it does, keep host-specific code in a thin adapter and keep the domain logic in the server.
Sources
- OpenAI, Introducing apps in ChatGPT and the new Apps SDK (October 2025)
- OpenAI, Apps SDK: Optimize metadata and Apps SDK reference
- Anthropic, Writing effective tools for agents, with agents (September 2025)
- Model Context Protocol, Tools, Schema and Authorization, spec version 2025-11-25
- Model Context Protocol blog, MCP Apps: bringing UI capabilities to MCP clients (January 26, 2026)