update_assistant
Modify an existing OpenAI assistant's name, instructions, or AI model to adapt it for changing requirements or improved performance.
Instructions
Modify an existing assistant's name, instructions, or model used.
At least one optional parameter - what to change - must be provided, otherwise the tool will return an error. The ID required can be retrieved from the list_assistants tool.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assistant_id | Yes | ||
| instructions | No | ||
| model | No | ||
| name | No |
Implementation Reference
- MCP tool handler and registration for 'update_assistant'. Validates parameters, handles errors, and calls the core AssistantManager implementation.@app.tool( annotations={ "title": "Update OpenAI Assistant", "readOnlyHint": False } ) async def update_assistant( assistant_id: str, name: str = None, instructions: str = None, model: str = None ) -> str: """ Modify an existing assistant's name, instructions, or model used. At least one optional parameter - what to change - must be provided, otherwise the tool will return an error. The ID required can be retrieved from the list_assistants tool. """ if not manager: raise ToolError("AssistantManager not initialized.") if not any([name, instructions, model]): raise ToolError("You must provide at least one field to update (name, instructions, or model).") try: result = await manager.update_assistant(assistant_id, name, instructions, model) return f"Successfully updated assistant '{result.name}' (ID: {result.id})." except Exception as e: raise ToolError(f"Failed to update assistant {assistant_id}: {e}")
- Core helper function in AssistantManager that performs the actual OpenAI API update_assistant call.async def update_assistant( self, assistant_id: str, name: Optional[str] = None, instructions: Optional[str] = None, model: Optional[str] = None ) -> Assistant: """Update an existing assistant's configuration.""" update_params = {} if name is not None: update_params["name"] = name if instructions is not None: update_params["instructions"] = instructions if model is not None: update_params["model"] = model return self.client.beta.assistants.update( assistant_id=assistant_id, **update_params )