create_api_key
Generate an API key for data ingestion into the Coroot observability platform. Specify project ID and name to create a key for sending metrics and data securely. The key secret is provided only upon creation.
Instructions
Create a new API key for data ingestion.
Creates an API key that can be used for sending metrics and data. The key secret is only returned once during creation.
Args: project_id: Project ID name: API key name description: Optional description
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | ||
| name | Yes | ||
| project_id | Yes |
Implementation Reference
- src/mcp_coroot/client.py:1171-1195 (handler)Core implementation of create_api_key: sends POST request to Coroot API endpoint /api/project/{project_id}/api_keys with action=generate to create and return new API key.async def create_api_key( self, project_id: str, name: str, description: str | None = None ) -> dict[str, Any]: """Create a new API key. Args: project_id: Project ID. name: API key name (used as description in Coroot). description: Optional description (not used by Coroot). Returns: Created API key with secret. """ # Coroot expects 'action' and 'description' fields data = { "action": "generate", "description": name, # Coroot uses 'description' not 'name' } response = await self._request( "POST", f"/api/project/{project_id}/api_keys", json=data, ) return self._parse_json_response(response)
- src/mcp_coroot/server.py:1537-1547 (handler)MCP tool handler wrapper: calls CorootClient.create_api_key and formats the success response with standardized structure.async def create_api_key_impl( project_id: str, name: str, description: str | None = None ) -> dict[str, Any]: """Create an API key.""" result = await get_client().create_api_key(project_id, name, description) return { "success": True, "message": "API key created successfully", "api_key": result, }
- src/mcp_coroot/server.py:1549-1563 (registration)FastMCP tool registration: defines the create_api_key tool with input parameters, docstring schema, and delegates to implementation.@mcp.tool() async def create_api_key( project_id: str, name: str, description: str | None = None ) -> dict[str, Any]: """Create a new API key for data ingestion. Creates an API key that can be used for sending metrics and data. The key secret is only returned once during creation. Args: project_id: Project ID name: API key name description: Optional description """ return await create_api_key_impl(project_id, name, description) # type: ignore[no-any-return]