Skip to main content
Glama
snilld-ai

OpenAI Assistant MCP Server

by snilld-ai

delete-file

Remove files from the OpenAI Assistant environment to manage storage and maintain organized workspaces by specifying file IDs.

Instructions

Delete a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYesThe ID of the file to delete

Implementation Reference

  • Implements the core logic for deleting a file using the OpenAI Files API.
    async def delete_file(self, file_id: str):
        try:
            response = await self.client.files.delete(file_id)
            return response
        except Exception as e:
            logger.error(f"Failed to delete file {file_id}: {str(e)}")
            raise
  • Registers the 'delete-file' tool with its name, description, and input schema in the list_tools callback.
    types.Tool(
        name="delete-file",
        description="Delete a file",
        inputSchema={
            "type": "object",
            "properties": {
                "file_id": {"type": "string", "description": "The ID of the file to delete"}
            },
            "required": ["file_id"]
        }
    )
  • Handles the tool call dispatch for 'delete-file' by extracting arguments and calling the LLMConnector's delete_file method.
    elif name == "delete-file":
        file_id = arguments["file_id"]
        response = await connector.delete_file(file_id)
        return [types.TextContent(type="text", text=f"File deleted: {response.id}, status: {'deleted' if response.deleted else 'not deleted'}")]

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