Skip to main content
Glama
effytech

Freshdesk MCP server

by effytech

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
NameRequiredDescriptionDefault
canned_response_fieldsYes

Implementation Reference

  • 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()
  • 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"
        )
  • The @mcp.tool() decorator registers the create_canned_response function as an MCP tool with the name 'create_canned_response'.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/effytech/freshdesk_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server