Skip to content

[SEP-2356] File input support for tools and elicitation#2217

Draft
ochafik wants to merge 1 commit intomainfrom
claude/file-upload-sep-sdks-8Rub5
Draft

[SEP-2356] File input support for tools and elicitation#2217
ochafik wants to merge 1 commit intomainfrom
claude/file-upload-sep-sdks-8Rub5

Conversation

@ochafik
Copy link
Contributor

@ochafik ochafik commented Mar 5, 2026

Summary

Prototype implementation of the file input SEP for the Python SDK. Adds Pydantic models for declarative file inputs on tools and elicitation forms, gated by a new fileInputs client capability.

SEP: modelcontextprotocol/modelcontextprotocol#2356

Note

This is a draft prototype tracking the spec proposal. It will be updated as the SEP evolves and should not be merged until the spec PR lands.

Changes

  • FileInputsCapability — empty capability class (matches FormElicitationCapability pattern); wired into ClientCapabilities.file_inputs
  • FileInputDescriptoraccept: list[str] | None, max_size: int | None
  • Tool.input_files: dict[str, FileInputDescriptor] | None
  • ElicitRequestFormParams.requested_files: dict[str, FileInputDescriptor] | None
  • Exports for new types and test coverage

StringArraySchema is intentionally omitted — the Python SDK models ElicitRequestedSchema as dict[str, Any] and does not enumerate primitive schema variants.

Implements declarative file input metadata so servers can tell clients which
tool arguments / elicitation form fields should receive a native file picker.

- FileInputDescriptor: Pydantic model with accept (MIME patterns) and max_size (bytes)
- FileInputsCapability: client capability gate
- Tool.input_files: maps arg names to FileInputDescriptor
- ElicitRequestFormParams.requested_files: symmetric for elicitation
- StringArraySchema: new PrimitiveSchemaDefinition member for multi-file fields

All models use alias_generator=to_camel for snake_case ↔ camelCase on the wire.
Files are transmitted as RFC 2397 data URIs: data:<mediatype>;name=<filename>;base64,<data>

https://claude.ai/code/session_01JxhHWiXrXgE4JWC27dznRN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants