-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Problem
The current box_file_upload_tool accepts content: str | bytes as a parameter, which works well for text-based files. However, when AI agents (e.g., Claude Desktop) attempt to upload binary files such as .pptx, .xlsx, .pdf, or .zip, the upload fails because:
- Agents cannot reliably pass raw binary data through the MCP tool's
contentparameter — binary data gets corrupted when serialized as text - There is no way to specify a local file path to upload directly from the filesystem
- The existing tool design assumes content is generated or available in memory, not read from an existing local file
This makes it impossible to upload Office documents or other binary files to Box through the MCP server.
Proposed Solution
Add a new tool box_file_upload_from_path_tool that accepts a local file path instead of inline content:
async def box_file_upload_from_path_tool(
ctx: Context,
file_path: str, # Absolute path to local file
parent_folder_id: str, # Box destination folder ID
file_name: Optional[str] = None, # Optional rename (defaults to original filename)
) -> dict[str, Any]:How it works
- Reads the file in binary mode (
rb), preserving the exact bytes - Delegates to the existing
box_file_upload()function frombox_ai_agents_toolkit - Validates the path (absolute, exists, is a file) before attempting upload
Benefits
- Supports all file types including
.pptx,.xlsx,.pdf,.zip, images, etc. - Simple for agents to use — just provide a file path
- Reuses existing upload infrastructure (no changes to
box_ai_agents_toolkitneeded) - Non-breaking — the existing
box_file_upload_toolremains unchanged
Use Case
A user asks an AI agent:
"Upload
/Users/me/Desktop/report.pptxto Box folder 12345"
Currently this fails. With the proposed tool, the agent calls:
{
"file_path": "/Users/me/Desktop/report.pptx",
"parent_folder_id": "12345"
}And the file is uploaded correctly with its binary content intact.
Environment
- mcp-server-box v0.7.0
- Transport: stdio
- Auth: OAuth
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels