Skip to content

Commit f4da5c3

Browse files
authored
Merge branch 'datacommonsorg:master' into master
2 parents 494375d + 17c8f84 commit f4da5c3

1 file changed

Lines changed: 43 additions & 31 deletions

File tree

mcp/run_tools.md

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This page shows you how to run a local agent and connect to a Data Commons MCP s
1313
* TOC
1414
{:toc}
1515

16-
We provide specific instructions for the following agents. All may be used to query datacommons.org or a Custom Data Commons instance.
16+
We provide specific instructions for the following agents. All may be used to query datacommons.org or a [Custom Data Commons instance](/custom_dc).
1717

1818
- [Gemini CLI extension](#use-the-gemini-cli-extension)
1919
- Best for querying datacommons.org
@@ -28,23 +28,23 @@ We provide specific instructions for the following agents. All may be used to qu
2828
- You can create your own LLM context file
2929
- Minimal setup
3030

31-
- A [sample basic agent](#use-the-sample-agent) based on the Google [Agent Development Kit](https://google.github.io/adk-docs/)
31+
- A [sample basic agent](#use-the-sample-agent) based on the Google [Agent Development Kit](https://google.github.io/adk-docs/){: target="_blank"}
3232
- Best for interacting with a Web GUI
3333
- Can be used to run other LLMs and prompts
3434
- Downloads agent code locally
3535
- Server may be run remotely
3636
- Some additional setup
3737

38-
For an end-to-end tutorial using a server and agent over HTTP, see the sample Data Commons Colab notebook, [Try Data Commons MCP Tools with a Custom Agent](https://github.com/datacommonsorg/agent-toolkit/blob/main/notebooks/datacommons_mcp_tools_with_custom_agent.ipynb).
38+
For an end-to-end tutorial using a server and agent over HTTP, see the sample Data Commons Colab notebook, [Try Data Commons MCP Tools with a Custom Agent](https://github.com/datacommonsorg/agent-toolkit/blob/main/notebooks/datacommons_mcp_tools_with_custom_agent.ipynb){: target="_blank"}.
3939

4040
For other clients/agents, see the relevant documentation; you should be able to reuse the commands and arguments detailed below.
4141

4242
## Prerequisites
4343

4444
These are required for all agents:
4545

46-
- A (free) Data Commons API key. To obtain an API key, go to <https://apikeys.datacommons.org> and request a key for the `api.datacommons.org` domain.
47-
- Install `uv` for managing and installing Python packages; see the instructions at <https://docs.astral.sh/uv/getting-started/installation/>.
46+
- A (free) Data Commons API key. To obtain an API key, go to <https://apikeys.datacommons.org>{: target="_blank"} and request a key for the `api.datacommons.org` domain.
47+
- Install `uv` for managing and installing Python packages; see the instructions at <https://docs.astral.sh/uv/getting-started/installation/>{: target="_blank"}.
4848

4949
Other requirements for specific agents are given in their respective sections.
5050

@@ -61,31 +61,47 @@ You can set these in the following ways:
6161
### Base Data Commons (datacommons.org)
6262

6363
For basic usage against datacommons.org, set the required `DC_API_KEY` in your shell/startup script (e.g. `.bashrc`).
64-
<pre>
65-
export DC_API_KEY="<var>YOUR API KEY</var>"
66-
</pre>
64+
65+
<div class="gcp-tab-group">
66+
<ul class="gcp-tab-headers">
67+
<li class="active">Linux or Mac shell</li>
68+
<li>Windows Powershell</li>
69+
</ul>
70+
<div class="gcp-tab-content">
71+
<div class="active">
72+
<pre>
73+
export DC_API_KEY="<var>YOUR API KEY</var>"</pre>
74+
</div>
75+
<div>
76+
<pre>
77+
$env:DC_API_KEY="<var>YOUR API KEY</var>"</pre>
78+
</div>
79+
</div>
80+
</div>
6781

6882
### Custom Data Commons
6983

70-
To run against a Custom Data Commons instance, you must set additional variables. All supported options are documented in [packages/datacommons-mcp/.env.sample](https://github.com/datacommonsorg/agent-toolkit/blob/main/packages/datacommons-mcp/.env.sample).
84+
To run against a Custom Data Commons instance, you must set additional variables. All supported options are documented in [packages/datacommons-mcp/.env.sample](https://github.com/datacommonsorg/agent-toolkit/blob/main/packages/datacommons-mcp/.env.sample){: target="_blank"}.
7185

7286
The following variables are required:
73-
- <code>export DC_API_KEY="<var>YOUR API KEY</var>"</code>
74-
- `export DC_TYPE="custom"`
75-
- <code>export CUSTOM_DC_URL="<var>YOUR_INSTANCE_URL</var>"</code>
87+
- <code>DC_API_KEY="<var>YOUR API KEY</var>"</code>
88+
- `DC_TYPE="custom"`
89+
- <code>CUSTOM_DC_URL="<var>YOUR_INSTANCE_URL</var>"</code>
90+
91+
You can also set additional variables as described in the `.env.sample` file.
7692

7793
{: #env}
7894
{: .no_toc}
7995
#### Set variables with an `.env` file:
8096

81-
1. From Github, download the file [`.env.sample`](https://github.com/datacommonsorg/agent-toolkit/blob/main/packages/datacommons-mcp/.env.sample) to the desired directory. Alternatively, if you plan to run the sample agent, clone the repo <https://github.com/datacommonsorg/agent-toolkit/>.
97+
1. From Github, download the file [`.env.sample`](https://github.com/datacommonsorg/agent-toolkit/blob/main/packages/datacommons-mcp/.env.sample){: target="_blank"} to the desired directory. Alternatively, if you plan to run the sample agent, clone the repo <https://github.com/datacommonsorg/agent-toolkit/>{: target="_blank"}.
8298

8399
1. From the directory where you saved the sample file, copy it to a new file called `.env`. For example:
84100
```bash
85101
cd ~/agent-toolkit/packages/datacommons-mcp
86102
cp .env.sample .env
87103
```
88-
1. Set the following variables, without quotes:
104+
1. Set the following required variables, without quotes:
89105
- `DC_API_KEY`: Set to your Data Commons API key
90106
- `DC_TYPE`: Set to `custom`.
91107
- `CUSTOM_DC_URL`: Uncomment and set to the URL of your instance.
@@ -98,10 +114,10 @@ The following variables are required:
98114
**Additional prerequisites**
99115

100116
In addition to the [standard prerequisites](#prerequisites), you must have the following installed:
101-
- [Git](https://git-scm.com/)
102-
- [Google Gemini CLI](https://geminicli.com/docs/get-started/)
117+
- [Git](https://git-scm.com/){: target="_blank"}
118+
- [Google Gemini CLI](https://geminicli.com/docs/get-started/installation/){: target="_blank"}
103119

104-
When you install the extension, it clones the [Data Commons extension Github repo](https://github.com/gemini-cli-extensions/datacommons) to your local system.
120+
When you install the extension, it clones the [Data Commons extension Github repo](https://github.com/gemini-cli-extensions/datacommons){: target="_blank"} to your local system.
105121

106122
{:.no_toc}
107123
### Install
@@ -157,7 +173,7 @@ This is usually due to a missing [Data Commons API key](#prerequisites). Be sure
157173
{:.no_toc}
158174
#### Failed to clone Git repository
159175

160-
Make sure you have installed [Git](https://git-scm.com/) on your system.
176+
Make sure you have installed [Git](https://git-scm.com/){: target="_blank"} on your system.
161177

162178
{:.no_toc}
163179
### Uninstall
@@ -169,12 +185,8 @@ gemini extensions uninstall datacommons
169185

170186
## Use Gemini CLI
171187

172-
Before installing, be sure to check the [Prerequisites](#prerequisites) above.
173-
174-
{:.no_toc}
175-
### Install
176-
177-
To install Gemini CLI, see the instructions at <https://github.com/google-gemini/gemini-cli#quick-install>.
188+
In addition to the [standard prerequisites](#prerequisites), you must have the following installed:
189+
- [Google Gemini CLI](https://geminicli.com/docs/get-started/installation/){: target="_blank"}
178190

179191
{:.no_toc}
180192
{: #gemini}
@@ -232,20 +244,18 @@ To configure Gemini CLI to recognize the Data Commons server, edit the relevant
232244
1. To see the Data Commons tools, use `/mcp tools`.
233245
1. Start sending [natural-language queries](#sample-queries).
234246

235-
> **Tip**: To ensure that Gemini CLI uses the Data Commons MCP tools, and not its own `GoogleSearch` tool, include a prompt to use Data Commons in your query. For example, use a query like "Use Data Commons tools to answer the following: ..." You can also add such a prompt to a [`GEMINI.md` file](https://codelabs.developers.google.com/gemini-cli-hands-on#9) so that it's persisted across sessions.
247+
> **Tip**: To ensure that Gemini CLI uses the Data Commons MCP tools, and not its own `GoogleSearch` tool, include a prompt to use Data Commons in your query. For example, use a query like "Use Data Commons tools to answer the following: ..." You can also add such a prompt to a [`GEMINI.md` file](https://codelabs.developers.google.com/gemini-cli-hands-on#9){: target="_blank"} so that it's persisted across sessions.
236248
237249
## Use the sample agent
238250

239-
We provide a basic agent for interacting with the MCP Server in [packages/datacommons-mcp/examples/sample_agents/basic_agent](https://github.com/datacommonsorg/agent-toolkit/tree/main/packages/datacommons-mcp/examples/sample_agents/basic_agent).
251+
We provide a basic agent for interacting with the MCP Server in [packages/datacommons-mcp/examples/sample_agents/basic_agent](https://github.com/datacommonsorg/agent-toolkit/tree/main/packages/datacommons-mcp/examples/sample_agents/basic_agent){: target="_blank"}.
240252

241253
**Additional prerequisites**
242254

243255
In addition to the [standard prerequisites](#prerequisites), you will need:
244-
- A GCP project and a Google AI API key. For details on supported keys, see <https://google.github.io/adk-docs/get-started/quickstart/#set-up-the-model>.
245-
- [Git](https://git-scm.com/) installed.
256+
- A GCP project and a Google AI API key. For details on supported keys, see <https://google.github.io/adk-docs/get-started/quickstart/#set-up-the-model>{: target="_blank"}.
257+
- [Git](https://git-scm.com/){: target="_blank"} installed.
246258

247-
{:.no_toc}
248-
### Set the API key environment variable
249259
{:.no_toc}
250260
### Install
251261

@@ -291,7 +301,7 @@ By default, the agent will spawn a local server and connect to it over Stdio. If
291301
If you want to connect to a remote MCP server, follow this procedure before starting the agent:
292302

293303
1. Start up the MCP server in standalone mode, as described in [Run a standalone server](#run-a-standalone-server).
294-
1. Modify the code in [`basic_agent/agent.py`](https://github.com/datacommonsorg/agent-toolkit/blob/main/packages/datacommons-mcp/examples/sample_agents/basic_agent/agent.py) to set import modules and agent initialization parameters as follows:
304+
1. Modify the code in [`basic_agent/agent.py`](https://github.com/datacommonsorg/agent-toolkit/blob/main/packages/datacommons-mcp/examples/sample_agents/basic_agent/agent.py){: target="_blank"} to set import modules and agent initialization parameters as follows:
295305

296306
```python
297307
from google.adk.tools.mcp_tool.mcp_toolset import (
@@ -334,3 +344,5 @@ By default, the host is `localhost` and the port is `8080` if you don't set thes
334344
The server is addressable with the endpoint `mcp`. For example, `http://my-mcp-server:8080/mcp`.
335345

336346
You can connect to the server using [Gemini CLI](#use-gemini-cli) or the [sample ADK agent](#use-the-sample-agent). If you're using a different client from the ones documented on this page, consult its documentation to determine how to specify an HTTP URL.
347+
348+
<script src="/assets/js/customdc-doc-tabs.js"></script>

0 commit comments

Comments
 (0)