Skip to main content
Glama
andybrandt

MCP Simple OpenAI Assistant

by andybrandt

list_assistants

Retrieve available OpenAI assistants with their IDs and configurations to select one for use without creating a new assistant.

Instructions

List all available OpenAI assistants associated with the API key configured by the user.

Returns a list of assistants with their IDs, names, and configurations. This can be used to select an assistant to use in the ask_assistant_in_thread tool instead of creating a new one.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • The main handler function for the 'list_assistants' tool, decorated with @app.tool for registration in the FastMCP server. It calls the AssistantManager to fetch assistants and formats them into a readable string output.
    annotations={ "title": "List OpenAI Assistants", "readOnlyHint": True } ) async def list_assistants(limit: int = 20) -> str: """ List all available OpenAI assistants associated with the API key configured by the user. Returns a list of assistants with their IDs, names, and configurations. This can be used to select an assistant to use in the ask_assistant_in_thread tool instead of creating a new one. """ if not manager: raise ToolError("AssistantManager not initialized.") try: assistants = await manager.list_assistants(limit) if not assistants: return "No assistants found." assistant_list = [ dedent(f""" ID: {a.id} Name: {a.name} Model: {a.model}""") for a in assistants ] return "Available Assistants:\\n\\n" + "\\n---\\n".join(assistant_list) except Exception as e: raise ToolError(f"Failed to list assistants: {e}")
  • Supporting utility method in AssistantManager that performs the actual OpenAI API call to list assistants.
    async def list_assistants(self, limit: int = 20) -> list[Assistant]: """List available OpenAI assistants.""" response = self.client.beta.assistants.list(limit=limit) return response.data

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