list_clients
Retrieve active or inactive clients from the Harvest MCP Server using optional filtering to efficiently manage and organize client data.
Instructions
List clients with optional filtering.
Args:
is_active: Pass true to only return active clients and false to return inactive clients
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| is_active | No |
Implementation Reference
- harvest-mcp-server.py:205-217 (handler)The handler function that implements the list_clients tool. It constructs parameters based on the is_active filter and calls the shared harvest_request helper to fetch clients from the Harvest API, returning the JSON response.async def list_clients(is_active: bool = None): """List clients with optional filtering. Args: is_active: Pass true to only return active clients and false to return inactive clients """ params = {} if is_active is not None: params["is_active"] = "true" if is_active else "false" response = await harvest_request("clients", params) return json.dumps(response, indent=2)
- harvest-mcp-server.py:204-204 (registration)The @mcp.tool() decorator registers the list_clients function as an MCP tool.@mcp.tool()
- harvest-mcp-server.py:21-43 (helper)Shared helper function used by list_clients (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()