Skip to main content
Glama

retrieve_stateful_response

Retrieve previous responses from Grok MCP to maintain conversation context and enable follow-up interactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
response_idYes

Implementation Reference

  • The 'retrieve_stateful_response' tool is defined as an MCP tool and handles the retrieval of a previously stored completion using the 'Client' utility.
    @mcp.tool(annotations=READONLY)
    async def retrieve_stateful_response(response_id: str):
        client = Client(api_key=XAI_API_KEY)
        responses = client.chat.get_stored_completion(response_id)
        client.close()
        if not responses:
            return f"No response found for id {response_id}"
        response = responses[0] if isinstance(responses, list) else responses
        return f"{response.content}\n\n**Response ID:** `{response.id}`"

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/merterbak/Grok-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server