Skip to content

SEP-2356: File input support for tools and elicitation#2356

Draft
ochafik wants to merge 11 commits intomainfrom
claude/file-upload-sep-sdks-8Rub5
Draft

SEP-2356: File input support for tools and elicitation#2356
ochafik wants to merge 11 commits intomainfrom
claude/file-upload-sep-sdks-8Rub5

Conversation

@ochafik
Copy link
Contributor

@ochafik ochafik commented Mar 5, 2026

Summary

This PR adds support for declarative file inputs in tools and elicitation forms, allowing servers to specify which arguments/fields should be rendered as file pickers by clients. Files are transmitted as RFC 2397 data URIs with embedded metadata.

Key Changes

  • Client capability: Added fileInputs capability to ClientCapabilities to allow clients to declare support for file input handling
  • Tool file inputs: Added inputFiles field to Tool interface to declare which tool arguments accept file inputs, with optional MIME type and size constraints
  • Elicitation file inputs: Added requestedFiles field to ElicitRequestFormParams for file inputs in elicitation forms
  • File input descriptor: Introduced FileInputDescriptor interface with optional accept (MIME type patterns) and maxSize (byte limit) fields for client-side validation hints
  • Schema support: Extended PrimitiveSchemaDefinition to include StringArraySchema for multi-file inputs in elicitation forms
  • StringArraySchema: Added new schema type for flat arrays of strings, intended for multi-file inputs where each item is a data URI

Implementation Details

  • File inputs are encoded as RFC 2397 data URIs with format: data:<mediatype>;name=<filename>;base64,<data>
  • The name= parameter is percent-encoded to preserve original filenames
  • Servers MUST NOT include file input fields unless the client declared the fileInputs capability
  • All validation hints in FileInputDescriptor are advisory; servers must independently validate inputs
  • Servers SHOULD reject oversized files with InvalidParamsError and reason "file_too_large"
  • Schema properties for file inputs MUST be {"type": "string", "format": "uri"} or arrays thereof

Prototype PRs

Related work

claude added 4 commits March 4, 2026 20:03
Proposes Tool.inputFiles and ElicitRequestFormParams.requestedFiles to
let servers declaratively mark which arguments expect user-selected
files. Clients declaring the fileInputs capability render native file
pickers and encode selections as data URIs (with a standardized name=
media-type parameter for filenames).

Key design points:
- inputFiles is a sibling of inputSchema (not an annotation hint)
- Per-argument accept[] MIME filters and maxSize limits
- Supports single-file and array-of-file arguments
- Adds StringArraySchema to PrimitiveSchemaDefinition for elicitation
- Capability gates advertising, not acceptance: servers always accept
  well-formed data URIs regardless of negotiation
- Error convention: -32602 with data.reason for size/type violations
- Cites OpenAI Apps SDK openai/fileParams as prior art

https://claude.ai/code/session_01UE8PfZW3WmKXvoqtamBbtp
- elicitation.form.fileInputs nests under existing client cap
- Tool-side stays top-level (no ClientCapabilities.tools exists)
- Independent gating: clients can support one surface without the other
- Add Open Questions section debating alt placements: new
  ClientCapabilities.tools namespace vs single unified flag

https://claude.ai/code/session_01UE8PfZW3WmKXvoqtamBbtp
One top-level ClientCapabilities.fileInputs flag instead of the split
approach. Rationale captured:
- Underlying capability (file picker + data URI encoding) is singular
- Elicitation is already gated by the elicitation capability itself
- Simpler server check
- No ClientCapabilities.tools exists to nest under anyway

Removes Open Questions section; the placement debate is resolved.

https://claude.ai/code/session_01UE8PfZW3WmKXvoqtamBbtp
… to schema

Implements the file upload SEP with declarative file input metadata:
- FileInputDescriptor: { accept?: string[], maxSize?: number } - advisory MIME filter + byte limit
- Tool.inputFiles: maps argument names to FileInputDescriptor for native file pickers
- ElicitRequestFormParams.requestedFiles: symmetric support for elicitation forms
- StringArraySchema: new PrimitiveSchemaDefinition member for multi-file inputs
- ClientCapabilities.fileInputs: capability gate (server MUST NOT send inputFiles without it)

Files are transmitted as RFC 2397 data URIs: data:<mediatype>;name=<filename>;base64,<data>

https://claude.ai/code/session_01JxhHWiXrXgE4JWC27dznRN
@ochafik ochafik changed the title Add declarative file input support for tools and elicitation SEP 2356 - File input support for tools and elicitation Mar 5, 2026
claude added 2 commits March 6, 2026 17:44
Introduces an Overview section in the SEP that walks reviewers through
the complete round trip on both surfaces before the formal spec:

- Tool: `describe_image` definition with `inputFiles`, paired with the
  matching `tools/call` request carrying a data-URI argument.
- Elicitation: `elicitation/create` request with `requestedFiles`,
  paired with the matching `ElicitResult` response carrying the
  data-URI content.

All examples use the same real (non-truncated) 1x1 PNG so the wire
encoding is concrete and copy-pasteable.

The same examples are added as validated JSON files under
schema/draft/examples/ and wired into schema.ts via @includecode so
they appear in the generated reference docs.

https://claude.ai/code/session_0168Rxur9BGcHnAzo3zpZkEH
Rename placeholder SEP file to 2356 (the PR number), fill in the
header title and PR link, and regenerate the SEP docs so the new
page appears in the community SEP index and navigation.

https://claude.ai/code/session_0168Rxur9BGcHnAzo3zpZkEH
Replace 'future SEP' framing in three places with direct guidance:
inputFiles covers the inline case, URL-mode elicitation covers files
too large to embed. No new transport machinery needed.

:house: Remote-Dev: homespace
… handling by surface

- Gate StringArraySchema behind fileInputs capability (SEP prose + schema.ts
  docstring) so existing form-mode clients aren't broken by an unrecognized
  PrimitiveSchemaDefinition member
- Clarify maxSize applies per-file for array-typed arguments
- Reword schema-shape constraints to permit extra properties; add SHOULD-ignore
  rule for malformed inputFiles/requestedFiles entries
- Require format:"uri" on StringArraySchema.items for file fields
- Add percent-encoding test vector; require name= before ;base64 per RFC 2397
- Define accept matching: type/subtype only, case-insensitive, params stripped
- Scope file_uri_malformed to broken data: URIs; non-data URIs are
  server-defined
- Split error handling into tool-call (-32602) vs elicitation-result
  (re-elicit or fail enclosing op) subsections

:house: Remote-Dev: homespace
@localden localden changed the title SEP 2356 - File input support for tools and elicitation SEP 2356: File input support for tools and elicitation Mar 15, 2026
claude added 2 commits March 17, 2026 15:04
…p-sdks-8Rub5

# Conflicts:
#	docs/community/seps/index.mdx
#	docs/docs.json
#	docs/seps/2356-declarative-file-inputs-for-tools-and-elicitation.mdx
The committed mdx was out of sync with its source .md (admonition
line break). Main never tripped this because the workflow only runs
when seps/**/*.md changes; adding 2356.md surfaces the drift.
@localden localden self-assigned this Mar 18, 2026
@localden localden added draft SEP proposal with a sponsor. and removed proposal SEP proposal without a sponsor. labels Mar 18, 2026
@localden localden changed the title SEP 2356: File input support for tools and elicitation SEP-2356: File input support for tools and elicitation Mar 18, 2026
@jakobwennberg
Copy link

Hey, great feature. Any timeline on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

draft SEP proposal with a sponsor. SEP

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants