retrieve_assistant
Retrieve detailed information about a specific OpenAI assistant using its unique ID, enabling users to access assistant configurations and capabilities.
Instructions
Get detailed information about a specific assistant. The ID required can be retrieved from the list_assistants tool.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assistant_id | Yes |
Implementation Reference
- MCP tool handler for retrieve_assistant: decorated with @app.tool decorator (serves as registration), validates manager init, calls AssistantManager.retrieve_assistant, formats and returns assistant details as string.@app.tool( annotations={ "title": "Retrieve OpenAI Assistant", "readOnlyHint": True } ) async def retrieve_assistant(assistant_id: str) -> str: """Get detailed information about a specific assistant. The ID required can be retrieved from the list_assistants tool.""" if not manager: raise ToolError("AssistantManager not initialized.") try: result = await manager.retrieve_assistant(assistant_id) return dedent(f""" Assistant Details: ID: {result.id} Name: {result.name} Model: {result.model} Instructions: {result.instructions} """) except Exception as e: raise ToolError(f"Failed to retrieve assistant {assistant_id}: {e}")
- Core helper method in AssistantManager class that performs the actual OpenAI API call to retrieve assistant details.async def retrieve_assistant(self, assistant_id: str) -> Assistant: """Get details about a specific assistant.""" return self.client.beta.assistants.retrieve(assistant_id)
- Input/output type annotations defining the tool schema: assistant_id: str -> str (formatted details). Note: OpenAI Assistant type used internally.async def retrieve_assistant(assistant_id: str) -> str:
- mcp_simple_openai_assistant/app.py:200-205 (registration)@app.tool decorator registers the retrieve_assistant function as an MCP tool with title and readOnlyHint metadata.@app.tool( annotations={ "title": "Retrieve OpenAI Assistant", "readOnlyHint": True } )
- Import of OpenAI Assistant type used in the retrieve_assistant method signature.from openai.types.beta import Assistant, Thread