get_db_instrumentation
Retrieve instrumentation configuration for specific database types (MySQL, PostgreSQL, Redis, MongoDB, Memcached) by providing project ID, application ID, and database type. Simplifies database monitoring integration in the Coroot observability platform.
Instructions
Get database instrumentation configuration.
Retrieves instrumentation settings for a specific database type.
Args: project_id: Project ID app_id: Application ID (format: namespace/kind/name) db_type: Database type (mysql, postgres, redis, mongodb, memcached)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| db_type | Yes | ||
| project_id | Yes |
Implementation Reference
- src/mcp_coroot/server.py:1166-1179 (handler)Primary MCP tool handler for 'get_db_instrumentation'. Decorated with @mcp.tool() for registration. Defines input schema via type hints and docstring. Delegates to internal implementation.@mcp.tool() async def get_db_instrumentation( project_id: str, app_id: str, db_type: str ) -> dict[str, Any]: """Get database instrumentation configuration. Retrieves instrumentation settings for a specific database type. Args: project_id: Project ID app_id: Application ID (format: namespace/kind/name) db_type: Database type (mysql, postgres, redis, mongodb, memcached) """ return await get_db_instrumentation_impl(project_id, app_id, db_type) # type: ignore[no-any-return]
- src/mcp_coroot/server.py:1153-1164 (helper)Internal helper implementation in server.py that obtains the CorootClient instance and calls the client's get_db_instrumentation method, wrapping the result in a success dict.@handle_errors async def get_db_instrumentation_impl( project_id: str, app_id: str, db_type: str ) -> dict[str, Any]: """Get database instrumentation config.""" client = get_client() config = await client.get_db_instrumentation(project_id, app_id, db_type) return { "success": True, "config": config, }
- src/mcp_coroot/client.py:1384-1407 (helper)CorootClient helper method that URL-encodes the app_id and makes a GET request to the Coroot API to fetch database instrumentation configuration, returning the raw JSON data.async def get_db_instrumentation( self, project_id: str, app_id: str, db_type: str ) -> dict[str, Any]: """Get database instrumentation configuration. Args: project_id: Project ID. app_id: Application ID. db_type: Database type (mysql, postgres, redis, mongodb, memcached). Returns: Database instrumentation configuration. """ # URL encode the app_id since it contains slashes from urllib.parse import quote encoded_app_id = quote(app_id, safe="") response = await self._request( "GET", f"/api/project/{project_id}/app/{encoded_app_id}/instrumentation/{db_type}", ) data: dict[str, Any] = response.json() return data