Skip to main content
Glama

get_chatgpt_response_tool

Retrieve responses from ChatGPT after submitting prompts via the ChatGPT MCP Server, enabling AI assistants to interact with the ChatGPT desktop app on macOS.

Instructions

Get the latest response from ChatGPT after sending a message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The @mcp.tool()-decorated handler function implementing the logic for get_chatgpt_response_tool by delegating to get_chatgpt_response().
    @mcp.tool()
    async def get_chatgpt_response_tool() -> str:
        """Get the latest response from ChatGPT after sending a message."""
        return await get_chatgpt_response()
  • Invokes setup_mcp_tools to register all MCP tools, including get_chatgpt_response_tool.
    # Setup MCP tools
    setup_mcp_tools(mcp)
  • Helper function containing the core logic: waits for response completion via polling and retrieves conversation text, called by the tool handler.
    async def get_chatgpt_response() -> str:
        """Get the latest response from ChatGPT after sending a message.
        
        Returns:
            ChatGPT's latest response text
        """
        try:
            # Wait for response to complete
            if wait_for_response_completion():
                return get_current_conversation_text()
            else:
                return "Timeout: ChatGPT response did not complete within the time limit."
            
        except Exception as e:
            raise Exception(f"Failed to get response from ChatGPT: {str(e)}")
  • Polling helper that repeatedly checks if conversation is complete using is_conversation_complete() until timeout.
    def wait_for_response_completion(max_wait_time: int = 300, check_interval: float = 2) -> bool:
        """Wait for ChatGPT response to complete.
        
        Args:
            max_wait_time: Maximum time to wait in seconds
            check_interval: How often to check for completion in seconds
            
        Returns:
            True if response completed within time limit, False if timed out
        """
        start_time = time.time()
        
        while time.time() - start_time < max_wait_time:
            if is_conversation_complete():
                return True
            time.sleep(check_interval)
        
        return False
  • Checks screen content via ChatGPTAutomation.read_screen_content() for conversationComplete indicator to determine if response is done.
    def is_conversation_complete() -> bool:
        """Check if ChatGPT conversation is complete using external AppleScript.
        
        Returns:
            True if conversation is complete, False if still in progress
        """
        try:
            automation = ChatGPTAutomation()
            screen_data = automation.read_screen_content()
            
            if screen_data.get("status") == "success":
                indicators = screen_data.get("indicators", {})
                
                # Simple check: only use conversationComplete indicator
                result = indicators.get("conversationComplete", False)
                print(f"[DEBUG] is_conversation_complete: {result}, indicators: {indicators}")
                return result
            else:
                print(f"[DEBUG] Screen read failed: {screen_data}")
                # If we can't read the screen, assume not complete for safety
                return False
                
        except Exception as e:
            print(f"[DEBUG] Exception in is_conversation_complete: {e}")
            # If any error occurs, assume not complete for safety
            return False
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions retrieving the 'latest response' but doesn't disclose behavioral traits such as whether this is read-only, requires authentication, has rate limits, or how it handles errors or empty states. The description is minimal and lacks critical operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (interacting with an external service like ChatGPT) and the lack of annotations and output schema, the description is insufficient. It doesn't explain what the response format is, error handling, or dependencies on other tools (e.g., requiring a prior message send), leaving significant gaps for an AI agent to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so no parameter documentation is needed. The description doesn't add parameter semantics, but this is acceptable given the absence of parameters, aligning with the baseline for zero parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('latest response from ChatGPT'), specifying it occurs 'after sending a message.' It distinguishes from 'ask_chatgpt_tool' (which sends messages) but doesn't explicitly differentiate from 'new_chatgpt_chat_tool' regarding chat context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage after sending a message via 'ask_chatgpt_tool,' providing some context. However, it lacks explicit guidance on when to use this versus alternatives (e.g., whether it retrieves responses only from the current chat session or across sessions) and doesn't mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/xncbf/chatgpt-mcp'

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