delete-assistant
Remove an OpenAI assistant by providing its ID to manage your assistant list and free up resources.
Instructions
Delete an OpenAI assistant
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assistant_id | Yes | The ID of the assistant to delete |
Implementation Reference
- src/mcp_server_openai/server.py:90-100 (registration)Registration of the 'delete-assistant' MCP tool, including its input schema requiring 'assistant_id'.types.Tool( name="delete-assistant", description="Delete an OpenAI assistant", inputSchema={ "type": "object", "properties": { "assistant_id": {"type": "string", "description": "The ID of the assistant to delete"} }, "required": ["assistant_id"] } ),
- src/mcp_server_openai/server.py:188-191 (handler)MCP server handler for 'delete-assistant' tool call; extracts assistant_id and delegates to LLMConnector.delete_assistant().elif name == "delete-assistant": assistant_id = arguments["assistant_id"] response = await connector.delete_assistant(assistant_id) return [types.TextContent(type="text", text=f"Assistant deleted: {response.id}, status: {'deleted' if response.deleted else 'not deleted'}")]
- src/mcp_server_openai/llm.py:79-85 (handler)Core implementation of delete_assistant in LLMConnector class; calls OpenAI API to delete the assistant by ID.async def delete_assistant(self, assistant_id: str): try: response = await self.client.beta.assistants.delete(assistant_id) return response except Exception as e: logger.error(f"Failed to delete assistant {assistant_id}: {str(e)}") raise