Skip to main content
Glama
snilld-ai

OpenAI Assistant MCP Server

by snilld-ai

upload-file

Upload files to OpenAI Assistants for processing and analysis, enabling document-based interactions through the MCP server.

Instructions

Upload a file for use by assistants

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesThe local path to the file to upload

Implementation Reference

  • Core handler implementation: uploads the file to OpenAI assistants using the OpenAI client.files.create API.
    async def upload_file(self, file_path: str): try: with open(file_path, "rb") as file: response = await self.client.files.create(file=file, purpose="assistants") return response except Exception as e: logger.error(f"Failed to upload file {file_path}: {str(e)}") raise
  • Tool registration in list_tools(), including name, description, and input schema.
    types.Tool( name="upload-file", description="Upload a file for use by assistants", inputSchema={ "type": "object", "properties": { "file_path": {"type": "string", "description": "The local path to the file to upload"} }, "required": ["file_path"] } ),
  • Dispatch handler in call_tool() that invokes the LLMConnector.upload_file method and formats the response.
    elif name == "upload-file": response = await connector.upload_file(arguments["file_path"]) return [types.TextContent(type="text", text=f"File uploaded: {response.filename}, ID: {response.id}")]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/snilld-ai/openai-assistant-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server