Skip to main content
Glama

research_poll_until_finished

Continuously poll a research task until it completes, then return the final output. Configure polling interval and timeout.

Instructions

Poll until research is finished using Exa.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
research_idYesThe unique identifier of the research task.
poll_intervalNoMilliseconds between polling attempts (default: 1000).
timeout_msNoMaximum time to wait in milliseconds (default: 600000).
eventsNoWhether to include events in the response.
output_schemaNoOptional Pydantic model for typed output validation.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'research_poll_until_finished' tool. It is decorated with @mcp.tool(), takes parameters (research_id, poll_interval, timeout_ms, events, output_schema), builds an arguments dict, and delegates to the remote Exa MCP server via _call_mcp_tool('exa_research_poll_until_finished', arguments).
    @mcp.tool()
    def research_poll_until_finished(
        research_id: str,
        poll_interval: int | None = None,
        timeout_ms: int | None = None,
        events: bool | None = None,
        output_schema: type[BaseModel] | None = None,
    ) -> dict[str, Any]:
        """Poll until research is finished using Exa.
    
        Args:
            research_id: The unique identifier of the research task.
            poll_interval: Milliseconds between polling attempts (default: 1000).
            timeout_ms: Maximum time to wait in milliseconds (default: 600000).
            events: Whether to include events in the response.
            output_schema: Optional Pydantic model for typed output validation.
    
        Returns:
            Dict containing the completed research task.
    
        Example:
            >>> research_poll_until_finished("abc-123")
            {"research_id": "abc-123", "status": "completed", "output": {...}}
        """
        import asyncio
    
        if not research_id:
            raise ValueError("Research ID cannot be empty")
    
        arguments: dict[str, Any] = {"research_id": research_id}
        if poll_interval is not None:
            arguments["poll_interval"] = poll_interval
        if timeout_ms is not None:
            arguments["timeout_ms"] = timeout_ms
        if events is not None:
            arguments["events"] = events
        if output_schema is not None:
            arguments["output_schema"] = output_schema
    
        try:
            result = asyncio.get_event_loop().run_until_complete(
                _call_mcp_tool("exa_research_poll_until_finished", arguments)
            )
            return result
        except Exception as e:
            return {"error": str(e)}
  • The tool is registered via the @mcp.tool() decorator on line 469, which registers it with the FastMCP server instance named 'mcp' (created on line 10 as fastmcp.FastMCP('mcp-exa')).
    @mcp.tool()
  • The _call_mcp_tool helper function that sends JSON-RPC requests to the public Exa MCP server. It constructs a 'tools/call' request and sends it to https://mcp.exa.ai/mcp, then parses Server-Sent Events (SSE) responses.
    async def _call_mcp_tool(tool_name: str, arguments: dict[str, Any]) -> dict[str, Any]:
        """Call a tool on the public Exa MCP server."""
        request = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "tools/call",
            "params": {
                "name": tool_name,
                "arguments": arguments,
            },
        }
    
        async with httpx.AsyncClient(timeout=60.0) as client:
            response = await client.post(
                f"{BASE_URL}/mcp",
                json=request,
                headers={
                    "accept": "application/json, text/event-stream",
                    "content-type": "application/json",
                },
            )
            response.raise_for_status()
            response_text = response.text
    
            lines = response_text.split("\n")
            for line in lines:
                if line.startswith("data: "):
                    data = line[6:]
                    result = {"jsonrpc": "2.0", "id": 1, "result": {}}
                    try:
                        parsed = eval(data)
                    except Exception:
                        pass
                    else:
                        if "result" in parsed and parsed["result"].get("content"):
                            return {
                                "results": parsed["result"]["content"][0].get("text", "")
                            }
    
            return {"results": ""}
  • Input parameter schema: research_id (str, required), poll_interval (int or None), timeout_ms (int or None), events (bool or None), output_schema (type[BaseModel] or None). Returns dict[str, Any].
    def research_poll_until_finished(
        research_id: str,
        poll_interval: int | None = None,
        timeout_ms: int | None = None,
        events: bool | None = None,
        output_schema: type[BaseModel] | None = None,
    ) -> dict[str, Any]:
Behavior3/5

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

With no annotations, the description must disclose behavior. It states polling until finished, but does not explain that it blocks, returns the final result, or handles timeouts/errors. The input schema provides poll_interval and timeout_ms, which partially compensate.

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

Conciseness4/5

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

The description is very concise at one sentence. It is front-loaded and clear, but could include more useful context without becoming verbose.

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

Completeness3/5

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

Given the presence of an output_schema parameter and siblings like research_create and research_get, the description is minimally complete. It does not explain that it returns the research result, which would help an agent understand the workflow.

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

Parameters3/5

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

Schema coverage is 100% with each parameter having a description. The tool description adds no additional parameter meaning beyond what the schema provides, so baseline score of 3 is appropriate.

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

Purpose5/5

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

The description 'Poll until research is finished using Exa' clearly states the action (poll), the resource (research), and the condition (until finished). It distinguishes itself from sibling tools like research_create (creation), research_get (single fetch), and research_list (listing) by emphasizing the polling behavior.

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 creating a research task, but does not explicitly state when to use this tool versus alternatives like research_get for manual polling or other research tools. No exclusion or alternative names are provided.

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

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/daedalus/mcp-exa'

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