.gemini/styleguide.md
This file (symlinked as CLAUDE.md, AGENTS.md, and .gemini/styleguide.md) provides context and guidelines for AI agents working on the MCP Toolbox for Databases project. It summarizes key information from CONTRIBUTING.md and DEVELOPER.md.
MCP Toolbox for Databases is a Go-based project designed to provide Model Context Protocol (MCP) tools for various data sources and services. It allows Large Language Models (LLMs) to interact with databases and other tools safely and efficiently.
golangci-lintcmd/: Application entry points.internal/sources/: Implementations of database sources (e.g., Postgres, BigQuery).internal/tools/: Implementations of specific tools for each source.tests/: Integration tests.docs/en: Project documentation. Separated logically into:
documentation/: Documentation and concepts (Section I).integrations/: Reference architectures for DB connectivity and tools (Section II).samples/: Tutorials and code samples (Section III).reference/: CLI info and FAQs (Section IV).go build -o toolboxgo run . (Listens on port 5000 by default)go run . --helpcurl http://127.0.0.1:5000go test -race -v ./cmd/... ./internal/...go test -race -v ./tests/<source_dir>go test -race -v ./tests/alloydbpg.ci/integration.cloudbuild.yamlgolangci-lint run --fixnpm ci).hugo directory: cd .hugonpm cihugo server alone will not populate the search bar. Build the local index first (using the development environment to block analytics) by running:
hugo --environment development && npx pagefind --site public --output-path static/pagefindhugo serverDocumentation builds automatically generate standard HTML alongside AI-friendly text files (llms.txt and llms-full.txt).
There are 6 workflows in total, handling parallel deployments to both GitHub Pages and Cloudflare Pages. All deployment workflows automatically execute npx pagefind --site public to generate version-scoped search indexes.
main deploy to the /dev/ path. Automatically defaults to version Dev./<version>/ and the root path. The release tag is automatically injected into the build as the documentation version. (Note: Developers must manually add the new version to the [[params.versions]] dropdown array in hugo.toml prior to merging a release PR).snake_case (e.g., list_collections, run_query).
firestore_list_collections).kebab-case (e.g., firestore-list-collections).
feat/, fix/, docs/, chore/ (e.g., feat/add-gemini-md).<type>(<scope>): <description>feat(source/postgres): add new connection optionfeat, fix, docs, chore, test, ci, refactor, revert, style.Format: <type>[optional scope]: <description>
feat(source/postgres): add support for "new-field" fieldfix(tool/sql)!: change default parameter value| Type | Description | Version change affected |
|---|---|---|
| BREAKING CHANGE | Anything with this type or a ! after the type/scope introduces a breaking API change. E.g. fix!: description or feat!: description. | major |
| feat | Adding a new feature to the codebase. | minor |
| fix | Fixing a bug or typo in the codebase. | patch |
| ci | Changes made to the continuous integration configuration files or scripts (usually the yml and other configuration files). | n/a |
| docs | Documentations-related PRs, including fixes on docs. | n/a |
| chore | Other small tasks or updates that don't fall into any of the types above. | n/a |
| perf | changed src code, with improvement of performance metrics. | n/a |
| refactor | Change src code but unlike feat, there are no tests broken and no lines lost coverage. | n/a |
| revert | Revert changes made in another commit. | n/a |
| style | updated src code, with only formatting and whitespace updates. In other words, this includes anything a code formatter or linter changes. | n/a |
| test | Changes made to test files. | n/a |
| build | Changes related to build of the projects and dependency. | n/a |
PRs addressing a specific source or tool should always add the source or tool name as scope.
The scope is formatted as <type>/<kind>. Common scopes include:
source/postgres, source/cloudsql-mysqltool/mssql-sql, tool/list-tablesauth/googleMultiple Scopes:
feat(source/postgres,source/alloydbpg): ....feat(new-db): adding support for new-db source and tool.Every PR must include a description that follows the repository's template:
1. Description A concise description of the changes (bug or feature), its impact, and a summary of the solution.
2. PR Checklist
! if this involves a breaking change3. Issue Reference
Use the format: Fixes #<issue_number> 🦕
internal/sources/<newdb>.Config and Source structs in internal/sources/<newdb>/<newdb>.go.SourceConfig interface (SourceConfigType, Initialize).Source interface (SourceType).init() to register the source.internal/sources/<newdb>/<newdb>_test.go.internal/tools/<newdb>/<toolname>.Config and Tool structs.ToolConfig interface (ToolConfigType, Initialize).Tool interface (Invoke, ParseParams, Manifest, McpManifest, Authorized).init() to register the tool.docs/en/integrations/<source_name>/source.md. Ensure the root _index.md file contains strictly only frontmatter and no markdown body text.docs/en/integrations/<source_name>/tools/<tool_name>.md. Ensure the tools/_index.md file contains strictly only frontmatter.docs/en/integrations/<source_name>/samples/. Ensure the samples/_index.md file contains strictly only frontmatter.shared_tools frontmatter parameter inside their tools/_index.md file. This file must contain only frontmatter..hugo/layouts/index.llms.txt and .hugo/layouts/index.llms-full.txt to keep the AI context synced with the site structure.When generating or editing documentation for this repository, you must strictly adhere to the following CI-enforced rules. Failure to do so will break the build.
integrations/**/source.md)source.md. Use _index.md solely as an empty structural folder wrapper containing only YAML frontmatter.Source always.title must always end with "Source" (e.g., title: "Postgres Source").#) headings in the markdown body.##) headings in this exact sequence.
## About (Required)## Available Tools (Optional)## Requirements (Optional)## Example (Required)## Reference (Required)## Advanced Usage (Optional)## Troubleshooting (Optional)## Additional Resources (Optional)## Available Tools section, you must include the {{< list-tools >}} shortcode beneath it.integrations/**/tools/*.md)tools/ subdirectory. The tools/ directory must contain an _index.md file consisting strictly of frontmatter.#) headings in the markdown body.##) headings in this exact sequence.
## About (Required)## Compatible Sources (Optional)## Requirements (Optional)## Parameters (Optional)## Example (Required)## Output Format (Optional)## Reference (Optional)## Advanced Usage (Optional)## Troubleshooting (Optional)## Additional Resources (Optional)## Compatible Sources section, you must include the {{< compatible-sources >}} shortcode beneath it.Sample code is aggregated visually in the UI via the Samples section, but the physical markdown files are distributed logically based on their scope.
docs/en/documentation/getting-started/docs/en/integrations/<source_name>/samples/. (The samples/_index.md wrapper must contain strictly only frontmatter).docs/en/samples/sample_filters in the frontmatter. Use specific tags for:
bigquery, alloydb)python, js, go)mcp, sdk)is_sample: true is present to prevent the sample from being excluded from the Samples Gallery.integrations/**/prebuilt-configs/*.md)prebuilt-configs/.documentation/configuration/prebuilt-configs/_index.md page uses the {{< list-prebuilt-configs >}} shortcode, which only detects directories named exactly prebuilt-configs.kind of the data source in internal/prebuiltconfigs/tools/ before choosing the integration folder.docs/)docs/ directory.