Skip to main content
Glama
andybrandt

MCP Simple OpenAI Assistant

by andybrandt

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
NameRequiredDescriptionDefault
assistant_idYes

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:
  • @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

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