get_user_details
Retrieve user details by providing a user ID. This tool is part of the Harvest MCP Server, which integrates with Harvest's time tracking API for managing time entries, projects, clients, and tasks.
Instructions
Retrieve details for a specific user.
Args:
user_id: The ID of the user to retrieve
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes |
Implementation Reference
- harvest-mcp-server.py:70-78 (handler)The handler function for the 'get_user_details' MCP tool. Registered via @mcp.tool() decorator. Fetches user details from the Harvest API endpoint 'users/{user_id}' using the shared harvest_request helper, formats response as indented JSON.@mcp.tool() async def get_user_details(user_id: int): """Retrieve details for a specific user. Args: user_id: The ID of the user to retrieve """ response = await harvest_request(f"users/{user_id}") return json.dumps(response, indent=2)
- harvest-mcp-server.py:21-43 (helper)Shared helper function used by get_user_details and other tools to make authenticated HTTP requests to the Harvest API.async def harvest_request(path, params=None, method="GET"): headers = { "Harvest-Account-Id": HARVEST_ACCOUNT_ID, "Authorization": f"Bearer {HARVEST_API_KEY}", "User-Agent": "Harvest MCP Server", "Content-Type": "application/json", } url = f"https://api.harvestapp.com/v2/{path}" async with httpx.AsyncClient() as client: if method == "GET": response = await client.get(url, headers=headers, params=params) else: response = await client.request(method, url, headers=headers, json=params) if response.status_code != 200: raise Exception( f"Harvest API Error: {response.status_code} {response.text}" ) return response.json()