create_assistant
Create a new OpenAI assistant with custom instructions and model selection for specific topic discussions. Define the assistant's behavior and capabilities to handle your conversational needs.
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 |
|---|---|---|---|
| instructions | Yes | ||
| model | No | gpt-4o | |
| name | Yes |
Implementation Reference
- mcp_simple_openai_assistant/app.py:20-40 (handler)The primary MCP tool handler for 'create_assistant'. This FastMCP-decorated function handles the tool invocation, input validation via type hints, calls the AssistantManager helper, 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}")
- mcp_simple_openai_assistant/app.py:20-25 (registration)The @app.tool decorator registers the 'create_assistant' function as an MCP tool with metadata like title and readOnlyHint.@app.tool( annotations={ "title": "Create OpenAI Assistant", "readOnlyHint": False } )
- Input schema defined by function parameters with type hints (name: str required, instructions: str required, model: str optional default 'gpt-4o') and output str.async def create_assistant(name: str, instructions: str, model: str = "gpt-4o") -> str:
- Helper method in AssistantManager class that executes the OpenAI Assistants API create call, returning the created Assistant object.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 )