Skip to main content
Glama

Change the status of many leads

change_leads_status
DestructiveIdempotent

Change the status of many leads

Changes every lead that matches the filters to new_status. There is no undo. The filters are listLeads' own and combine the same way, so listLeads with the same query lists the leads this takes (those already in new_status are left alone and not counted). status is required, so a call always names the statuses it takes leads from (422 invalid_request_body without it); limit and cursor aren't taken (422 invalid_request_body). Each lead that changes gets a status-change note on its contact's timeline, as updateLead writes, and a new last_activity_at; nobody is assigned, and the agent's status flow is not applied. dry_run is required: send dry_run: true first, which returns how many leads would change and changes nothing. A changed of 0 means there is nothing to change: don't send the real call. Otherwise send the same query with dry_run: false and that number as max_changes: if more would change by then, nothing changes (409 too_many_leads); send a dry run again and confirm the new number. Leads change in batches of 1,000, so if a call fails part way, the leads already changed stay changed: send a dry run again to see how many are left, then the call with that number. Admin rank on the agent, as in the dashboard.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "agent_id": "<agent_id>",
      "status": "<status>",
      "new_status": "<new_status>",
      "dry_run": "<dry_run>"
    },
    "name": "change_leads_status"
  }
}

Input Schema

NameRequiredDescriptionDefault
searchNoMatches the name or phone.
statusYesThe statuses to take leads from, comma-separated, written exactly as `listLeadFields` returns them.
date_toNoOnly those created on or before this date (UTC), the whole day included. Send a date such as `2026-10-11`; a date-time is read as its date.
dry_runYes`true` counts the leads that would change and changes nothing. Required, so leaving it out never changes leads.
agent_idYesThe agent the resource belongs to. Another company's agent, or the nil UUID, is `404 agent_not_found`; an agent outside the key's agent list is `403 agent_not_authorized`.
date_fromNoOnly those created on or after this date (UTC). Send a date such as `2026-10-01`; a date-time is read as its date.
new_statusYesThe `value` of one of the agent's lead statuses as `listLeadFields` returns it; matched without regard to case.
assigned_toNoOnly the leads assigned to this teammate (a `user_id` from `listAgentMembers`), or `unassigned` for the leads assigned to no one. `me` isn't taken, because a key isn't a person; it and any other value are `422 invalid_request_body`.
max_changesNoThe most leads this call may change: send the dry run's `changed` (a dry run of 0 has nothing to change, so don't send the call). If more would change, nothing changes (`409 too_many_leads`).
custom_fieldsNoOnly the leads whose custom fields match: a URL-encoded JSON object that maps a field's key (from `listLeadFields`) to a clause, such as `{"city": {"op": "eq", "values": ["Cairo"]}, "budget": {"op": "is_null"}}`. `op` is `eq` (one value), `in` (one or more), `ilike` (one value the field contains, ignoring case, where `%` and `_` are wildcards), `between` (two values: from the first, included, to the second, excluded) or `is_null` (no `values`). Values are JSON strings, numbers or booleans, compared with the stored value as text: write dates `YYYY-MM-DD` for `between`, and don't expect numbers to compare by size. Clauses combine with AND. A lead without the key reads as null there: it matches `is_null` and no other op. At most 10 keys and 100 values in all; anything else is `422 invalid_request_body`.
last_activity_sinceNoOnly the leads last worked (`last_activity_at`: a status change or a new note) later than this instant: ISO 8601 with an offset, such as `Z`. Must be earlier than `last_activity_before`, or it is `422 invalid_request_body`.
last_activity_beforeNoOnly the leads last worked at or before this instant: ISO 8601 with an offset, such as `Z`. Leads nobody has touched since then.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already flag destructiveHint and idempotentHint, but the description adds far more: there is no undo, leads run in batches of 1,000 so partial failures leave earlier changes committed, already-`new_status` leads are skipped and not counted, a status-change note lands on the contact timeline and `last_activity_at` is bumped, no one is assigned, and the agent's status flow is not applied. It also discloses the admin-rank requirement and the specific 409/422 failure modes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, impact, and filter relationship before the dry-run workflow, and every sentence carries operational weight — no filler. It is a dense single block though; the multi-step protocol and the recovery path would read faster broken into steps.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter destructive bulk mutation with no output schema, the definition covers the safety protocol, permission prerequisite, partial-failure recovery, error codes, and side effects. An agent can execute the confirm-then-apply sequence correctly without consulting anything else.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds cross-parameter meaning the schema cannot: `status` is mandatory because every call must name its source statuses, `limit` and `cursor` are rejected outright, and `max_changes` must be the dry run's `changed` value or the whole call aborts. It stops short of restating the richer per-field semantics (custom_fields operators, date handling), which it correctly delegates to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb plus resource and scope: it changes EVERY lead matching the filters to `new_status`, not one lead. That scope alone separates it from `update_lead`, and the description further anchors it by saying its filters are `listLeads`' own, so an agent knows exactly which query surface it is operating on.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit call sequence: `dry_run: true` first, then the identical query with `dry_run: false` and the reported `changed` as `max_changes`. It also states when NOT to call (`changed` of 0) and what to do on `409 too_many_leads` and mid-batch failure. Alternatives for single-lead work (`updateLead`) and for previewing the set (`listLeads`) are named.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources