Skip to content

LangChain Exa Search get_code_context_exa

How to: LangChain Exa Search get_code_context_exa

client:LangChain transport:stdio tool:get_code_context_exa

Add Exa Search to LangChain

  1. 01

    Open pip install langchain-mcp-adapters and merge this in. Keep any servers already there.

from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient({
        "exa-mcp-server": {
            "transport": "stdio",
            "command": "npx",
            "args": ["-y", "exa-mcp-server"],
        }
})

tools = await client.get_tools()
  1. 02

    Save the file and restart LangChain.

  2. 03

    Ask for something get_code_context_exa does. LangChain lists the server's tools on connect and calls get_code_context_exa itself — you do not invoke it by name.

  3. 04

    If nothing happens, check the server is running and that Exa Search's identifier in your config matches the one above exactly.

get_tools() returns the server's tools as LangChain tools, ready for an agent. LangChain docs

Set these first

Exa Search will not start until these are set, so get_code_context_exa never becomes available.

  • EXA_API_KEY

Same tool, other clients

Mutating and Read-only are read off each tool's name, not its schema — a hint, not a guarantee. The registry stores tool names only; connect the server for its live schemas.