create_group
Automate support operations by creating groups in Freshdesk through the MCP server. Enhance ticket management and streamline customer support processes using structured group fields.
Instructions
Create a group in Freshdesk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_fields | Yes |
Implementation Reference
- src/freshdesk_mcp/server.py:841-868 (handler)The main handler function for the 'create_group' tool. It validates the input using the GroupCreate Pydantic model and sends a POST request to the Freshdesk API to create a new group.@mcp.tool() async def create_group(group_fields: Dict[str, Any]) -> Dict[str, Any]: """Create a group in Freshdesk.""" # Validate input using Pydantic model 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" headers = { "Authorization": f"Basic {base64.b64encode(f'{FRESHDESK_API_KEY}:X'.encode()).decode()}", "Content-Type": "application/json" } async with httpx.AsyncClient() as client: try: response = await client.post(url, headers=headers, json=group_data) response.raise_for_status() return response.json() except httpx.HTTPStatusError as e: return { "error": f"Failed to create group: {str(e)}", "details": e.response.json() if e.response else None }
- src/freshdesk_mcp/server.py:90-111 (schema)Pydantic model defining the schema and validation rules for the input parameters of the create_group tool.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:841-841 (registration)The @mcp.tool() decorator registers the create_group function as an MCP tool with the name 'create_group'.@mcp.tool()