This is a Gemini CLI extension that allows you to query public datasets from Data Commons using natural language, and to ground AI responses from any any other tools in authoritative data, to reduce hallucinations.
This page provides basic instructions for installing and running the extension. For complete information on using Data Commons with Gemini CLI, please see the Data Commons documentation.
Before using this extension, you will need:
- Gemini CLI installed.
- 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.
uv, a tool for managing and installing Python packages: install from https://docs.astral.sh/uv/getting-started/installation/.- git installed.
- Set your Data Commons API key as an environment variable in your shell or startup script (e.g.
.bashrc):export DC_API_KEY=<YOUR_API_KEY> - Install the extension directly from GitHub:
gemini extensions install https://github.com/gemini-cli-extensions/datacommons
Note: If you have previously configured Gemini CLI to use the Data Commons MCP Server in a
settings.jsonfile (e.g.~/.gemini/settings.json) and want to use the extension instead, be sure to delete thedatacommons-mcpsection from the file.
- Run
gemini. - To verify that the Data Commons tools are running, enter
/mcp list. You should see thedatacommons-mcptools listed as "ready". If you don't, try running in debug mode to get diagnostic information. - Ask questions about statistical data in natural language.
- "What is the population of California?"
- "Show me the median income in Santa Clara County."
- "Compare the GDP of Japan and Germany."
- "Poverty indicators for India"
This extension uses the datacommons-mcp PyPI package, which runs a local MCP server to translate natural language queries into Data Commons API calls. This package is based on the Data Commons MCP Server from the Data Commons Agent Toolkit.
The extension also provides a context file (DATACOMMONS.md) that gives the Gemini agent instructions on how to handle user queries and tool responses.
You can diagnose common errors, such as invalid API keys, by using the debug flag:
gemini -d
To uninstall the extension, run:
gemini extensions uninstall datacommons