Skip to main content
Glama

get_contents

Retrieve web page content for one or multiple URLs. Get textual data from specified web addresses.

Instructions

Retrieve contents for a list of URLs using Exa.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlsYesA single URL or list of URLs to retrieve contents from.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The 'get_contents' tool handler (registered with @mcp.tool()). Takes a URL or list of URLs, validates input, wraps in an arguments dict, and delegates to the remote Exa MCP server via _call_mcp_tool('exa_get_contents', ...).
    @mcp.tool()
    def get_contents(urls: str | list[str]) -> dict[str, Any]:
        """Retrieve contents for a list of URLs using Exa.
    
        Args:
            urls: A single URL or list of URLs to retrieve contents from.
    
        Returns:
            Dict containing the contents of each URL.
    
        Example:
            >>> get_contents(["https://example.com/article1", "https://example.com/article2"])
            {"results": [{"url": "...", "title": "...", "text": "..."}]}
        """
        import asyncio
    
        if not urls:
            raise ValueError("URLs cannot be empty")
    
        if isinstance(urls, str):
            urls = [urls]
    
        arguments: dict[str, Any] = {"urls": urls}
    
        try:
            result = asyncio.get_event_loop().run_until_complete(
                _call_mcp_tool("exa_get_contents", arguments)
            )
            return result
        except Exception as e:
            return {"error": str(e)}
  • The tool is registered via the @mcp.tool() decorator on the get_contents function, which uses fastmcp's FastMCP instance ('mcp' created on line 10) to register the function as an MCP tool.
    @mcp.tool()
  • The _call_mcp_tool helper function is the underlying RPC client that sends JSON-RPC requests to the public Exa MCP endpoint. get_contents calls this with tool name 'exa_get_contents' and the urls arguments.
    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": ""}
Behavior2/5

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

With no annotations, the description must disclose behavioral traits but does not mention read-only nature, rate limits, authentication needs, or error handling. 'Retrieve contents' is minimal and leaves the agent uninformed about side effects or constraints.

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?

Single sentence with no wasted words. Information is front-loaded and directly conveys the core action. Efficient and to the point.

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 tool's simplicity (one parameter, has output schema), the description provides the minimal necessary information about what the tool does. However, it lacks context on output format or edge cases, relying on the output schema for completeness.

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 description coverage is 100%, so baseline is 3. The description adds no meaning beyond the schema's parameter description; it does not clarify acceptable URL formats, limits, or expected behavior for invalid inputs.

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 clearly states the tool retrieves contents for URLs using Exa, specifying verb and resource. It distinguishes from siblings like search and find_similar by focusing on content retrieval rather than searching or finding similar.

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

Usage Guidelines2/5

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

No guidance on when to use this tool over alternatives (e.g., search or find_similar). The description simply states what it does without suggesting use cases 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

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