create_agent
Create an agent within Freshdesk to manage support operations. Define agent details to streamline ticket handling and enhance customer support efficiency.
Instructions
Create an agent in Freshdesk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_fields | Yes |
Implementation Reference
- src/freshdesk_mcp/server.py:776-804 (handler)The primary handler function for the 'create_agent' tool. It is decorated with @mcp.tool(), which registers it in the FastMCP server. Performs input validation for required fields (email, ticket_scope) and makes a POST request to the Freshdesk API to create a new agent.@mcp.tool() async def create_agent(agent_fields: Dict[str, Any]) -> Dict[str, Any]: """Create an agent in Freshdesk.""" # Validate mandatory fields if not agent_fields.get("email") or not agent_fields.get("ticket_scope"): return { "error": "Missing mandatory fields. Both 'email' and 'ticket_scope' are required." } if agent_fields.get("ticket_scope") not in [e.value for e in AgentTicketScope]: return { "error": "Invalid value for ticket_scope. Must be one of: " + ", ".join([e.name for e in AgentTicketScope]) } url = f"https://{FRESHDESK_DOMAIN}/api/v2/agents" headers = { "Authorization": f"Basic {base64.b64encode(f'{FRESHDESK_API_KEY}:X'.encode()).decode()}" } async with httpx.AsyncClient() as client: try: response = await client.post(url, headers=headers, json=agent_fields) response.raise_for_status() return response.json() except httpx.HTTPStatusError as e: return { "error": f"Failed to create agent: {str(e)}", "details": e.response.json() if e.response else None }
- src/freshdesk_mcp/server.py:74-78 (helper)IntEnum defining the possible ticket scope values (GLOBAL_ACCESS=1, GROUP_ACCESS=2, RESTRICTED_ACCESS=3) used for validating the 'ticket_scope' field in the create_agent handler.class AgentTicketScope(IntEnum): GLOBAL_ACCESS = 1 GROUP_ACCESS = 2 RESTRICTED_ACCESS = 3