Database Insights Source
2 minute read
About
The databaseinsights source provides a client to interact with the Google Cloud Database Insights API (databaseinsights.googleapis.com). This source supports the Advanced Query Insights tools that are available via the remote Database Insights MCP Server, allowing tools to retrieve query performance statistics, wait event metrics, time-series trends, and index recommendations for Google Cloud databases like AlloyDB.
Authentication is handled via Application Default Credentials (ADC) using OAuth 2.0 access tokens.
Available Tools
Database Insights Source Tools
| Tool Name | Description |
|---|---|
| databaseinsights-get-advanced-aggregated-query-stats | Fetches aggregated query performance statistics (latency, execution count, wait time) for AlloyDB instances. |
| databaseinsights-get-advanced-aggregated-wait-event-stats | Fetches aggregated wait event statistics for AlloyDB instances to identify performance bottlenecks. |
| databaseinsights-get-advanced-time-series-query-stats | Fetches time-series performance trends for queries executed on AlloyDB instances. |
| databaseinsights-get-advanced-time-series-wait-event-stats | Fetches time-series wait event statistics for AlloyDB instances over time. |
| databaseinsights-get-index-recommendations | Fetches index recommendations for specified query IDs across databases on AlloyDB instances. |
Requirements
API Enablement
Enable the required Google Cloud APIs on your target project:
- AlloyDB API (
alloydb.googleapis.com) - Database Insights API (
databaseinsights.googleapis.com)
Roles required to enable APIs:
To enable APIs, you need the serviceusage.services.enable permission. If you created the project, you likely already have this permission through the Owner role (roles/owner). Otherwise, you can obtain this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin).
IAM Roles & Permissions
To query performance metrics, wait events, and index recommendations, grant the appropriate IAM roles on the target project or database location:
- View Cloud Monitoring data: Monitoring Viewer (
roles/monitoring.viewer) - View Database Insights data: Database Insights Viewer (
roles/databaseinsights.viewer)
Fine-grained Database Insights permissions:
- Get advanced aggregated query statistics:
databaseinsights.queryStats.fetch - Get advanced time series query statistics:
databaseinsights.queryTimeSeries.fetch - Get advanced aggregated wait event statistics:
databaseinsights.waitEventStats.fetch - Get advanced time series wait event statistics:
databaseinsights.waitEventTimeSeries.fetch - Get index recommendations:
databaseinsights.indexRecommendations.batchQuery,databaseinsights.recommendations.query,databaseinsights.resourceRecommendations.query
Example
kind: source
name: database-insights-source
type: databaseinsights
---
kind: source
name: custom-project-database-insights
type: databaseinsights
project: my-quota-project
Reference
| field | type | required | description |
|---|---|---|---|
| type | string | true | Must be “databaseinsights”. |
| project | string | false | The Google Cloud project ID to use as a fallback billing/quota project for API calls if not extracted from the resource path. |
| endpoint | string | false | Override API endpoint URL (e.g., for staging or testing environments). Defaults to https://databaseinsights.googleapis.com. |
Additional Resources
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.