create_canned_response
Automate support ticket responses by creating pre-defined canned messages in Freshdesk, streamlining customer service workflows and improving efficiency.
Instructions
Create a canned response in Freshdesk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| canned_response_fields | Yes |
Implementation Reference
- src/freshdesk_mcp/server.py:559-577 (handler)The main handler function for the 'create_canned_response' tool. It validates input using CannedResponseCreate model, makes a POST request to Freshdesk API to create the canned response, and returns the response.@mcp.tool() async def create_canned_response(canned_response_fields: Dict[str, Any])-> Dict[str, Any]: """Create a canned response in Freshdesk.""" # Validate input using Pydantic model try: validated_fields = CannedResponseCreate(**canned_response_fields) # Convert to dict for API request canned_response_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/canned_responses" headers = { "Authorization": f"Basic {base64.b64encode(f'{FRESHDESK_API_KEY}:X'.encode()).decode()}" } async with httpx.AsyncClient() as client: response = await client.post(url, headers=headers, json=canned_response_data) return response.json()
- src/freshdesk_mcp/server.py:149-163 (schema)Pydantic model defining the input schema for creating a canned response, used for validation in the handler.class CannedResponseCreate(BaseModel): title: str = Field(..., description="Title of the canned response") content_html: str = Field(..., description="HTML version of the canned response content") folder_id: int = Field(..., description="Folder where the canned response gets added") visibility: int = Field( ..., description="Visibility of the canned response (0=all agents, 1=personal, 2=select groups)", ge=0, le=2 ) group_ids: Optional[List[int]] = Field( None, description="Groups for which the canned response is visible. Required if visibility=2" )
- src/freshdesk_mcp/server.py:559-559 (registration)The @mcp.tool() decorator registers the create_canned_response function as an MCP tool with the name 'create_canned_response'.@mcp.tool()