Repository navigation
feat(gmail): one drafts capability with declarative, host-fulfilled attachments (SEP-2356 shape) - #3657
feat(gmail): one drafts capability with declarative, host-fulfilled attachments (SEP-2356 shape)#3657benjaminshafii wants to merge 2 commits into
Conversation
…ttachments Agents could not attach files to Gmail drafts: attachments lived on a separate local extension action invisible to cloud capability search, so sessions concluded attachments were impossible (looked like a regression of #3458; it was a discoverability split). Standard-shaped fix (MCP SEP-2356 declarative file inputs): - gmail-drafts bodySchema gains attachments: workspace file paths annotated with an x-mcp-file descriptor. The schema is the discovery surface; no steering prose. - If paths reach the cloud JSON route, it creates nothing and answers 422 file_input_requires_host with a descriptor naming the local extension action that owns the byte transport. - The desktop plugin fulfills it in a generic tool.execute.after hook: re-runs the request through openwork-cloud-uploads (the existing authenticated multipart lane) and rewrites the tool result in place. One capability, one successful call; bytes never transit model context. - search_capabilities matches now carry the route description and score against it, so guidance written for agents is no longer dropped on /mcp/agent. Hosts without the plugin (or old builds) get the honest 422 with next steps instead of silent failure. Drive and future file-carrying capabilities can reuse the same descriptor + hook unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Deploying openwork with
|
| Latest commit: |
5c4eb75
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0605983e.openwork.pages.dev |
| Branch Preview URL: | https://feat-gmail-draft-file-inputs.openwork.pages.dev |
|
Deployment failed for project openwork-app with the following error: Learn More: https://vercel.com/docs/limits#rate-limits |
|
Deployment failed for project openwork-landing with the following error: Learn More: https://vercel.com/docs/limits#rate-limits |
|
Deployment failed for project openwork-den with the following error: Learn More: https://vercel.com/docs/limits#rate-limits |
|
Superseded by #4685: the existing Gmail draft capability now advertises workspace attachments, with fixed host fulfillment, selected-connection preservation, cancellation handling, and published exact-head boundary proof. Closing this proposal in favor of the clean replacement. |
Problem
An agent asked to email a workspace file reported: "The Gmail capability can't add attachments... no such capability exists on this connection." Attachments were not gone — #3458 correctly moved bytes off model context — but the replacement lived on a separate local extension action that cloud
search_capabilitiescan never return, and the one sentence pointing to it (the route description) was stripped from/mcp/agentsearch results. A capability split patched over with prose is not discoverable by construction.Standard practice
This is the exact problem the MCP File Uploads Working Group exists for. Its charter names the anti-pattern we had ("servers resort to prose instructions asking for base64 strings or local paths") and anchors on SEP-2356: declarative file inputs — file inputs are declared on the tool's input schema via an
x-mcp-filedescriptor (accept/maxSize), the host fulfills the file slot (the model passes paths/references, never bytes), and large files route through URL-mode elicitation (SEP-1036, Final). Prior art: OpenAI Apps SDKopenai/fileParams.Design
One capability, intent-shaped schema; transport is plumbing.
gmail-draftsdeclares the file input (ee/apps/den-api/src/routes/org/google-workspace.ts):attachments— workspace file paths, annotatedx-mcp-file: { maxSize: 4 MiB, maxFiles: 10 }. The schema rides along in everysearch_capabilitiesmatch (bodySchema), so discovery is data, not steering. Summary no longer says "without attachments".attachmentsreaches the JSON route, it creates nothing and answers422 file_input_requires_hostwith a machine-readable descriptor:{ field, extensionId, action, argsField }.apps/server/src/opencode-plugins/openwork-extensions-preview-file-inputs.ts): atool.execute.afterhook onopenwork-cloud_execute_capabilityspots that error, re-runs the request through the descriptor's local action — the existingopenwork-cloud-uploadsauthenticated multipart lane (authorized-roots + 4 MiB enforcement unchanged) — and rewrites the tool result in place. The model sees one capability and one successful call.ee/apps/den-api/src/mcp/search.ts,native-capabilities.ts,agent.ts): matches now carry the routedescriptionand score against it;/mcp/agentno longer drops text written specifically for agents.Degradation is honest: hosts without the hook (old desktop, Cursor/Claude Code on
/mcp/agent) get the 422 with explicit next steps. Drive upload and any future file-carrying capability reuse the same descriptor + hook with zero new code paths. When SEP-2356 ratifies, the schema surface is already conformant.Tests
Commands run locally (macOS, worktree off
origin/dev):apps/server:bun test src/opencode-plugins/openwork-extensions-preview-file-inputs.test.ts src/extensions/cloud-uploads.test.ts src/extensions-connect-gating.test.ts— 18 pass / 0 fail (3 consecutive runs);bun test src/opencode-plugins/openwork-extensions-preview.test.ts src/opencode-plugins/openwork-extensions-preview-connect-steering.test.ts— 32 pass / 0 fail;pnpm --filter openwork-server typecheck— clean;pnpm --filter openwork-server build— bundles the new hook intodist/opencode-plugins/openwork-extensions-preview.js.ee/apps/den-api:pnpm exec tsc -p tsconfig.json --noEmit— clean;bun test test/gmail-draft.test.ts test/mcp-catalog-parameter-refs.test.ts— 18 pass / 0 fail; direct check thatx-mcp-filesurviveshono-openapiresolution and thatsearch_capabilities("gmail draft with attachments")returns the capability with description + descriptor.origin/dev):test/google-workspace-capabilities.test.ts— extended with a422 file_input_requires_hostroute test (assertsgoogleCallCount === 0) and discoverability assertions for the new summary/description/x-mcp-file.Verification status
Incomplete — runtime-observable change; no
@openwork/testkittape yet. The end-to-end claim ("agent asks to email a file → one tool call → draft with attachment, bytes outside model context") needs anevals/specs/*.slow.test.tsagainst a Gmail witness plus the DB-backed den suite in CI/Daytona. Repro for the core loop without the app: run the den 422 test against a seeded den, then feed its response throughrepairFileInputToolResult(covered by the new unit tests).