2026-06-15
Give Your Artifact Publish Tool an Output Schema
A practical guide to shaping MCP publishing results so agents return stable BinHTML links, review metadata, and predictable next steps.

Table of contents
- Why the publish result needs a contract
- The minimum useful shape for one artifact
- Use the same pattern for project links and compare flows
- Keep structured output small and safe
- Final checklist
Why the publish result needs a contract
A publish tool sits at a boundary: the model is done generating HTML, and the next step is review, sharing, or revision. If that boundary returns a loose blob of fields, every client and prompt has to guess what matters.
The MCP spec now treats tool outputs as a first-class schema surface. Tools can declare an outputSchema, and when they do, servers must return structured results that match it. OpenAI's Apps SDK has also started recommending outputSchema for tools that return structured content.
That matters for BinHTML-style workflows because publishing is not the end of the task. The next agent or human still needs a clean handoff. They need a stable link, a title, a visibility state, and enough review metadata to know what to do next.
This is the same product stance behind MCP docs and API docs: publish the artifact once, then pass around the managed link.
The minimum useful shape for one artifact
For a single published artifact, keep the structured result boring and explicit.
A practical schema usually includes:
artifactIdfor the system recordurlfor the viewer link the user should openmanagementUrlfor visibility, expiry, revocation, and source settingstitlefor the published artifact namevisibilityfor the current share modeexpiresAtwhen the link is time-boxedsourceAvailableso reviewers know whether source inspection is possiblecompareUrlwhen the publish step created or updated a revision chainnextActionas one short sentence the agent can show directly
This is narrower than returning the whole publish payload from your backend. That is deliberate. The model needs the fields that drive the next action, not every storage detail.
If your current tool still returns raw markup or a giant unschematized JSON object, fix that first. The companion pattern is covered in Return Links, Not HTML: MCP Tool Results for Generated Artifacts.
Use the same pattern for project links and compare flows
The benefit gets bigger when one prompt publishes more than one thing.
If an agent creates a report, an appendix, and a dashboard, the tool result should still have one clear top-level handoff. Usually that means a project share URL plus a short list of included artifacts. Keep the shape consistent with single-artifact publishing so prompts do not need a different mental model.
A simple progression looks like this:
- Publish each artifact.
- Return one project link for the bundle.
- Include optional compare metadata when the output is a revision rather than a first publish.
That plays well with BinHTML's project-link and review workflow. The user opens one share page, then drills into the artifact viewer or compare when they need to inspect a revision. If you need the broader bundle pattern, pair this post with Project Share Pages: One URL for a Multi-Artifact Handoff.
Keep structured output small and safe
Schema discipline is also a security and privacy decision.
OpenAI's MCP guidance warns against putting sensitive information in tool JSON, and the Apps SDK security guidance recommends including only the data required for the current prompt. That fits publishing tools well.
Good structured output should usually avoid:
- raw
sourceHtml - tokens, signed URLs, or bearer credentials
- large embedded source snapshots
- internal storage paths that are not useful to the reviewer
If reviewers need deeper provenance, give them a product surface for that instead of pushing everything into the tool result. In BinHTML terms, that usually means the viewer link, the management link, and explicit source-access controls. The deeper audit trail belongs in the published artifact workflow, not in every chat transcript. For that side of the handoff, see Source Access: The Audit Trail for AI-Generated HTML.
Final checklist
Before you ship a publish tool for generated HTML, check five things:
- The tool declares an
outputSchemawhen it returns structured content. - The result includes the viewer URL and the management URL as separate fields.
- The top-level shape works for both one artifact and a grouped project handoff.
- The result does not repeat raw HTML or sensitive data.
- The agent can turn the structured result into one short final message without custom parsing.
Final thought: the best artifact publishing tools are predictable. A clean outputSchema turns BinHTML links into a reusable handoff format instead of a one-off prompt trick.
Sources
- https://modelcontextprotocol.io/specification/draft/server/tools
- https://developers.openai.com/apps-sdk/changelog
- https://developers.openai.com/apps-sdk/plan/tools
- https://developers.openai.com/apps-sdk/guides/security-privacy
- https://developers.openai.com/api/docs/mcp
- https://code.claude.com/docs/en/mcp