# create_filter (/docs/mcp/tools/create-filter)

{/* Generated by scripts/sync-mcp-tools.mjs from happierleads-api. Do not edit: change src/routes/mcp/toolDocs.json there, or add content/mcp-notes/create_filter.mdx. */}

**Save a lead filter** · Changes data

Save a lead filter under a name so it shows as a saved view on the leads page and can be used as an automation segment. url is a query string of lead filter parameters (the same names get_leads uses); date and pagination parameters are removed before saving, so a saved filter always applies to whatever date range is chosen. websiteId comes from list_websites. Saving the same name twice creates two filters. Returns the saved filter (_id, name, url, tab).

| Connection | Account URL, team member URL or OAuth |
| --- | --- |

## Parameters [#parameters]

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `websiteId` | `string` | Yes | Website id (24 hex characters) from list_websites. |
| `name` | `string` | Yes | Name shown for the saved view, e.g. "US SaaS visitors". |
| `url` | `string` | Yes | Query string of filter parameters, e.g. "?visitorLocation=US&industries=Software&tag=HOT". dateFrom, dateTo, page and similar date/pagination parameters are stripped. |

## Tool definition [#tool-definition]

What your assistant receives from `tools/list`:

```json
{
  "name": "create_filter",
  "title": "Save a lead filter",
  "annotations": {
    "title": "Save a lead filter",
    "readOnlyHint": false,
    "destructiveHint": false,
    "idempotentHint": false,
    "openWorldHint": false
  },
  "inputSchema": {
    "type": "object",
    "properties": {
      "websiteId": {
        "type": "string",
        "description": "Website id (24 hex characters) from list_websites."
      },
      "name": {
        "type": "string",
        "description": "Name shown for the saved view, e.g. \"US SaaS visitors\"."
      },
      "url": {
        "type": "string",
        "description": "Query string of filter parameters, e.g. \"?visitorLocation=US&industries=Software&tag=HOT\". dateFrom, dateTo, page and similar date/pagination parameters are stripped."
      }
    },
    "required": [
      "websiteId",
      "name",
      "url"
    ]
  }
}
```
