create_assistant
Create a custom OpenAI assistant by specifying its name, instructions, and model to handle specific topics or tasks.
Instructions
Create a new OpenAI assistant to talk to about your desired topic.
You can provide instructions that this assistant will follow and specify which of OpenAI's models it will use. NOTE: It is recommended to check existing assistants with list_assistants before creating a new one.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| instructions | Yes | ||
| model | No | gpt-4o |
Implementation Reference
- mcp_simple_openai_assistant/app.py:20-39 (handler)MCP tool handler and registration for 'create_assistant'. Decorated with @app.tool(). Delegates to AssistantManager.create_assistant and formats the response.@app.tool( annotations={ "title": "Create OpenAI Assistant", "readOnlyHint": False } ) async def create_assistant(name: str, instructions: str, model: str = "gpt-4o") -> str: """ Create a new OpenAI assistant to talk to about your desired topic. You can provide instructions that this assistant will follow and specify which of OpenAI's models it will use. NOTE: It is recommended to check existing assistants with list_assistants before creating a new one. """ if not manager: raise ToolError("AssistantManager not initialized.") try: result = await manager.create_assistant(name, instructions, model) return f"Created assistant '{result.name}' with ID: {result.id}" except Exception as e: raise ToolError(f"Failed to create assistant: {e}")
- Core implementation that calls OpenAI API to create the assistant. Called by the MCP tool handler.async def create_assistant( self, name: str, instructions: str, model: str = "gpt-4o" ) -> Assistant: """Create a new OpenAI assistant.""" return self.client.beta.assistants.create( name=name, instructions=instructions, model=model )