update_group
Modify group details in Freshdesk by specifying the group ID and updated fields. Ideal for managing support team structures and permissions efficiently within the Freshdesk MCP server.
Instructions
Update a group in Freshdesk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_fields | Yes | ||
| group_id | Yes |
Implementation Reference
- src/freshdesk_mcp/server.py:912-934 (handler)The main handler function for the 'update_group' tool. It validates input using GroupCreate model, makes a PUT request to Freshdesk API to update the group, and handles errors. The @mcp.tool() decorator registers it as an MCP tool.@mcp.tool() async def update_group(group_id: int, group_fields: Dict[str, Any]) -> Dict[str, Any]: """Update a group in Freshdesk.""" try: validated_fields = GroupCreate(**group_fields) # Convert to dict for API request group_data = validated_fields.model_dump(exclude_none=True) except Exception as e: return {"error": f"Validation error: {str(e)}"} url = f"https://{FRESHDESK_DOMAIN}/api/v2/groups/{group_id}" headers = { "Authorization": f"Basic {base64.b64encode(f'{FRESHDESK_API_KEY}:X'.encode()).decode()}" } async with httpx.AsyncClient() as client: try: response = await client.put(url, headers=headers, json=group_data) response.raise_for_status() return response.json() except httpx.HTTPStatusError as e: return { "error": f"Failed to update group: {str(e)}", "details": e.response.json() if e.response else None }
- src/freshdesk_mcp/server.py:90-110 (schema)Pydantic schema (BaseModel) defining the input structure and validation for group updates (and creations). Used in the update_group handler for validating group_fields.class GroupCreate(BaseModel): name: str = Field(..., description="Name of the group") description: Optional[str] = Field(None, description="Description of the group") agent_ids: Optional[List[int]] = Field( default=None, description="Array of agent user ids" ) auto_ticket_assign: Optional[int] = Field( default=0, ge=0, le=1, description="Automatic ticket assignment type (0 or 1)" ) escalate_to: Optional[int] = Field( None, description="User ID to whom escalation email is sent if ticket is unassigned" ) unassigned_for: Optional[UnassignedForOptions] = Field( default=UnassignedForOptions.THIRTY_MIN, description="Time after which escalation email will be sent" )
- src/freshdesk_mcp/server.py:79-89 (helper)Enum defining options for the 'unassigned_for' field in GroupCreate schema, used in update_group validation.class UnassignedForOptions(str, Enum): THIRTY_MIN = "30m" ONE_HOUR = "1h" TWO_HOURS = "2h" FOUR_HOURS = "4h" EIGHT_HOURS = "8h" TWELVE_HOURS = "12h" ONE_DAY = "1d" TWO_DAYS = "2d" THREE_DAYS = "3d"