update_contact
Modify contact details in Freshdesk by specifying the contact ID and updating relevant fields. Streamline customer data management within the Freshdesk ecosystem.
Instructions
Update a contact in Freshdesk.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contact_fields | Yes | ||
| contact_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"contact_fields": {
"title": "Contact Fields",
"type": "object"
},
"contact_id": {
"title": "Contact Id",
"type": "integer"
}
},
"required": [
"contact_id",
"contact_fields"
],
"title": "update_contactArguments",
"type": "object"
}
Implementation Reference
- src/freshdesk_mcp/server.py:511-524 (handler)The handler function for the 'update_contact' tool, decorated with @mcp.tool() which serves as its registration in the MCP server. This function implements the core logic to update a contact in Freshdesk by sending a PUT request to the /api/v2/contacts/{contact_id} endpoint with the provided fields.@mcp.tool() async def update_contact(contact_id: int, contact_fields: Dict[str, Any])-> Dict[str, Any]: """Update a contact in Freshdesk.""" url = f"https://{FRESHDESK_DOMAIN}/api/v2/contacts/{contact_id}" headers = { "Authorization": f"Basic {base64.b64encode(f'{FRESHDESK_API_KEY}:X'.encode()).decode()}" } data = {} for field, value in contact_fields.items(): data[field] = value async with httpx.AsyncClient() as client: response = await client.put(url, headers=headers, json=data) return response.json() @mcp.tool()