retrieve-assistant
Retrieve an OpenAI assistant by its unique ID to access its configuration and capabilities for integration or management tasks.
Instructions
Retrieve an OpenAI assistant by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assistant_id | Yes | The ID of the assistant to retrieve |
Implementation Reference
- src/mcp_server_openai/server.py:152-157 (handler)The tool handler logic for 'retrieve-assistant' in the @server.call_tool() function. It extracts the assistant_id, validates it, calls the LLMConnector helper, and formats the response.elif name == "retrieve-assistant": assistant_id = arguments.get("assistant_id") if not assistant_id: raise ValueError("assistant_id is required for retrieve-assistant") response = await connector.retrieve_assistant(assistant_id) return [types.TextContent(type="text", text=f"Assistant Details:\\n{response}")]
- src/mcp_server_openai/server.py:46-56 (registration)Registration of the 'retrieve-assistant' tool in the @server.list_tools() function, including its description and input schema.types.Tool( name="retrieve-assistant", description="Retrieve an OpenAI assistant by ID", inputSchema={ "type": "object", "properties": { "assistant_id": {"type": "string", "description": "The ID of the assistant to retrieve"} }, "required": ["assistant_id"] } ),
- src/mcp_server_openai/llm.py:34-40 (helper)The core helper method in LLMConnector class that makes the OpenAI API call to retrieve the assistant by ID.async def retrieve_assistant(self, assistant_id: str): try: response = await self.client.beta.assistants.retrieve(assistant_id) return response except Exception as e: logger.error(f"Failed to retrieve assistant {assistant_id}: {str(e)}") raise