Skip to main content
Glama
andybrandt

MCP Simple OpenAI Assistant

by andybrandt

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
NameRequiredDescriptionDefault
instructionsYes
modelNogpt-4o
nameYes

Implementation Reference

  • 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}")
  • 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 )

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/andybrandt/mcp-simple-openai-assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server