> ## Documentation Index
> Fetch the complete documentation index at: https://uom-demo.vercel.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# mcp_database

> [<span className="flex items-center gap-1"><Icon icon="external-link"/>View Source</span>](https://github.com/corovcam/Universal-Object-Mapping/tree/main/services/orchestrator/src/react_agent/custom_tools/mcp_database.py)

Database tool functions powered by the googleapis/genai-toolbox MCP.

Loads tools from the running MCP Toolbox for Databases server, which provides
prebuilt tools for MSSQL and Neo4j, plus custom MongoDB tools defined in
database\_tools.yaml.

#### react\_agent.custom\_tools.mcp\_database.modify\_toolbox\_sources

```python theme={null}
async def modify_toolbox_sources(context: Context) -> None
```

[<span className="flex items-center gap-1"><Icon icon="external-link" />View Source</span>](https://github.com/corovcam/Universal-Object-Mapping/blob/main/services/orchestrator/src/react_agent/custom_tools/mcp_database.py#L34)

Dynamically write database connection configurations to the MCP Toolbox settings file.

Extracts connection strings (MSSQL, Neo4j, MongoDB) from the provided runtime Context,
translates localhost URIs to Docker host gateway IPs (since the toolbox runs in Docker),
and overwrites the `custom_config.yaml` used by the external MCP Database Toolbox.

**Arguments**:

* `context` *Context* - The agent's runtime context containing database connection strings.

**Raises**:

* `Exception` - If writing the configuration file fails.

#### react\_agent.custom\_tools.mcp\_database.load\_toolbox\_tools

```python theme={null}
@asynccontextmanager
async def load_toolbox_tools() -> AsyncGenerator[list[BaseTool], None]
```

[<span className="flex items-center gap-1"><Icon icon="external-link" />View Source</span>](https://github.com/corovcam/Universal-Object-Mapping/blob/main/services/orchestrator/src/react_agent/custom_tools/mcp_database.py#L86)

Asynchronously connect to the MCP Toolbox for Databases and expose its tools.

This context manager connects to the generic database MCP server (which provides schema
inspection tools for SQL and Graph databases) and converts them into LangChain-compatible
Tool objects for the ReAct agent. If the connection fails, it gracefully yields an empty list.

**Yields**:

* `list[BaseTool]` - A list of LangChain-compatible tool objects ready to be bound to an LLM.

#### react\_agent.custom\_tools.mcp\_database.load\_mongodb\_tools

```python theme={null}
@asynccontextmanager
async def load_mongodb_tools() -> AsyncGenerator[list[BaseTool], None]
```

[<span className="flex items-center gap-1"><Icon icon="external-link" />View Source</span>](https://github.com/corovcam/Universal-Object-Mapping/blob/main/services/orchestrator/src/react_agent/custom_tools/mcp_database.py#L123)

Asynchronously connect to the MongoDB MCP server and expose its tools.

This context manager establishes an SSE connection to a dedicated MongoDB MCP server.
It registers the custom tools prefix to avoid naming collisions and converts the remote
capabilities into LangChain Tool objects. Fails gracefully by yielding an empty list.

**Yields**:

* `list[BaseTool]` - A list of LangChain-compatible tool objects for MongoDB interactions.
