list-assistants
Retrieve available OpenAI assistants to manage and select AI models for specific tasks within the MCP server environment.
Instructions
List OpenAI assistants
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list-assistants"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_server_openai/server.py:145-150 (handler)Tool handler for 'list-assistants': calls LLMConnector.list_assistants() and formats the list of assistants as text.
elif name == "list-assistants": response = await connector.list_assistants() assistants_str = "\\n".join([f"- ID: {a.id}, Name: {a.name}, Model: {a.model}" for a in response]) if not assistants_str: assistants_str = "No assistants found." return [types.TextContent(type="text", text=f"Assistants:\\n{assistants_str}")] - src/mcp_server_openai/llm.py:26-32 (helper)Core helper method in LLMConnector that retrieves the list of OpenAI assistants using the AsyncOpenAI client.
async def list_assistants(self): try: response = await self.client.beta.assistants.list() return response.data except Exception as e: logger.error(f"Failed to list assistants: {str(e)}") raise - src/mcp_server_openai/server.py:38-45 (registration)Registers the 'list-assistants' tool in the MCP server list_tools() handler, including its schema.
types.Tool( name="list-assistants", description="List OpenAI assistants", inputSchema={ "type": "object", "properties": {} } ), - Input schema for the 'list-assistants' tool: empty object (no parameters required).
inputSchema={ "type": "object", "properties": {} }