create_resource_group
Create a new resource group for organizing monitors with customizable alerting and health thresholds.
Instructions
Create a resource group.
Required fields: name. Optional: description.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The create_resource_group tool handler function. Uses @mcp.tool() decorator. Takes a typed CreateResourceGroupRequest body (requires 'name', optional 'description'), calls the Devhelm SDK's resource_groups.create(), and serializes the result.
@mcp.tool() def create_resource_group( body: CreateResourceGroupRequest, api_token: str | None = None, ) -> ToolResult: """Create a resource group. Required fields: name. Optional: description. """ try: return serialize( get_client(api_token).resource_groups.create(as_payload(body)) ) except DevhelmError as e: raise_tool_error(e) - Imports the CreateResourceGroupRequest schema from devhelm.types, which defines the input validation (required field: name, optional: description).
"""Resource group tools — logical grouping of monitors.""" from __future__ import annotations from devhelm import DevhelmError from devhelm.types import ( AddResourceGroupMemberRequest, CreateResourceGroupRequest, UpdateResourceGroupRequest, ) from fastmcp import FastMCP - src/devhelm_mcp/tools/resource_groups.py:22-23 (registration)The register() function is called by server.py (line 110: mod.register(mcp)) to register all resource group tools on the FastMCP instance. The @mcp.tool() decorator on line 39 registers 'create_resource_group'.
def register(mcp: FastMCP) -> None: @mcp.tool() - src/devhelm_mcp/server.py:90-110 (registration)The server iterates ALL_TOOL_MODULES (which includes resource_groups) and calls mod.register(mcp) to register all tools, including create_resource_group.
ALL_TOOL_MODULES = [ monitors, incidents, forensics, alert_channels, notification_policies, environments, secrets, tags, resource_groups, webhooks, api_keys, dependencies, deploy_lock, maintenance_windows, status, status_pages, ] for mod in ALL_TOOL_MODULES: mod.register(mcp) - Imports helper utilities used by create_resource_group: ToolResult, as_payload (converts Pydantic model to dict), get_client (builds SDK client), raise_tool_error (converts SDK errors to MCP ToolError), and serialize (formats results).
from devhelm_mcp.client import ( ToolResult, as_payload, get_client, raise_tool_error, serialize, )