Skip to main content
Glama
andybrandt

MCP Simple OpenAI Assistant

by andybrandt

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

Implementation Reference

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

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