Skip to main content
Glama

callingly

Query account data

query_account_data
Read-only

Read this account's data. Returns JSON rows. Use it for counts, breakdowns and lists across leads, calls, texts, reps and teams — look things up rather than guessing. Prefer the specialised tools where one fits: query_reports for report metrics (connection rate, talk time, per-rep performance, computed as the Reports page does); search_leads to find a particular lead; get_lead for one lead's full profile (tags, custom fields, notes); get_recording for a call's recording and transcript.

Two modes:

  • List rows: give select (or leave it out for sensible defaults), filters, order_by, limit.

  • Aggregate: give group_by and/or aggregates. With only aggregates you get one summary row.

Dates: date_from / date_to are YYYY-MM-DD in the account's timezone (America/Phoenix), both inclusive, applied to the resource's default date column unless date_field names another. All stored times are UTC; time buckets in group_by are converted to the account's timezone.

group_by entries: a column name, or a time bucket written bucket:column where bucket is one of hour, day, week, month, hour_of_day, day_of_week (1 = Sunday). aggregates entries: count, or function:column where function is count_distinct, sum, avg, min or max (e.g. avg:seconds, count_distinct:lead_id). Each comes back as a column named like avg_seconds. filters: objects {field, op, value?, values?}. op is one of eq, neq, gt, gte, lt, lte, in, not_in, contains, starts_with, is_null, not_null. Use values for in / not_in. Booleans are 1 / 0. order_by: a column or an aggregate's output name (e.g. count); order_dir asc or desc.

Ids point at other resources (e.g. calls.user_id is users.id, profile_id is teams.id): query those to turn ids into names. To learn what values a column holds, group by it.

Resources:

  • leads: People who came in to be called (web forms, CRMs, API, inbound calls). Default date column: created_at. Columns: id (lead id); profile_id (team the lead is routed to (teams.id)); original_profile_id (team the lead first arrived on (teams.id)); lead_owner_id (owning rep (users.id)); fname (first name); lname (last name); email (email); phone_number (E.164 phone number); company (company); category (category); source (where the lead came from (form, integration name, api, inbound)); crm (CRM the lead was synced from, if any); status (lead status); result (latest call result); outcome (latest disposition); stage_id (pipeline stage (stages.id)); sequence_id (follow-up sequence enrolled in (sequences.id)); current_attempt (number of call attempts so far); response_time (seconds from lead creation to first call); is_blocked (1 when the number is blocked); is_stopped (1 when follow-ups were stopped); is_sms_stopped (1 when the lead opted out of SMS); next_followup_at (next scheduled follow-up (UTC)); called_at (first called (UTC)); contacted_at (first reached a human (UTC)); created_at (created (UTC)); updated_at (last updated (UTC))

  • calls: Every call: speed-to-lead dispatches, AI calls, follow-ups, inbound and manual calls. One row per call, with the outcome. Default date column: created_at. Columns: id (call id); lead_id (lead (leads.id)); profile_id (team (teams.id)); user_id (rep who took the call (users.id), null if nobody answered or an AI handled it); ai_agent_id (AI agent that handled it (ai_agents.id)); number_id (Callingly number involved (numbers.id)); integration_id (integration that triggered it (integrations.id)); phone_number (lead phone number); direction (inbound or outbound); type (call type); source (what started the call); status (call status); ring_status (team ring status); lead_status (lead leg status); human_result (result recorded by the rep); machine_result (answering-machine detection result); is_voicemail (1 when it reached voicemail); seconds (talk time in seconds); minutes (billed minutes); response_time (seconds from lead creation to this call); scheduled_call_type (kind of scheduled follow-up this call was, if any); is_ai_screened (1 when an AI screened the lead first); is_ai_only (1 when only the AI handled it); is_human_only (1 when only humans handled it); is_ai_handed_off (1 when the AI warm-transferred to a rep); ai_outcome (AI call outcome (e.g. transferred, scheduled, voicemail, not interested)); ai_call_type (AI call type); is_error (1 when the call errored); error_code (error code); stage_id (stage set on the call (stages.id)); tag_id (tag set on the call (tags.id)); summary (AI summary of the conversation); transcript (full transcript (long; select only for a few calls)); started_at (started (UTC)); ended_at (ended (UTC)); created_at (created (UTC))

  • call_legs: One row per rep rung on a call: who was rung, whether they answered, how long it rang. Use for rep answer rates and missed calls. Default date column: created_at. Columns: id (leg id); call_id (call (calls.id)); user_id (rep rung (users.id)); type (device rung); is_called (1 when the rep was actually rung); is_answered (1 when the rep picked up); is_accepted (1 when the rep accepted the call); is_voicemail (1 when the rep leg went to voicemail); is_busy (1 when the rep was busy); is_offline (1 when the rep was offline); is_dnd (1 when the rep was on do-not-disturb); is_canceled (1 when the leg was cancelled (another rep answered first)); is_error (1 when the leg errored); seconds (talk seconds on this leg); queue_time (seconds in queue); ringing_at (started ringing (UTC)); answered_at (answered (UTC)); created_at (created (UTC))

  • sms: Text messages sent and received. Default date column: created_at. Columns: id (message id); lead_id (lead (leads.id)); user_id (rep who sent it (users.id), null for automated or inbound); direction (inbound or outbound); status (delivery status); from (sending number); to (receiving number); body (message text); source (what sent it (sequence, AI, rep, …)); is_error (1 when delivery failed); error_code (carrier error code); sent_at (sent (UTC)); created_at (created (UTC))

  • scheduled_calls: Upcoming follow-up calls and callbacks that have not been placed yet. Default date column: scheduled_at. Columns: id (scheduled call id); lead_id (lead (leads.id)); profile_id (team (teams.id)); lead_owner_id (owning rep (users.id)); type (follow-up type); source (what scheduled it); scheduled_at (when it will be placed (UTC)); is_queued (1 when already queued to dial); is_sms_only (1 when it only sends a text); is_ai_only (1 when an AI will place it); is_human_only (1 when only humans will be rung); created_at (created (UTC))

  • scheduled_sms: Texts queued to send later. Default date column: send_at. Columns: id (id); lead_id (lead (leads.id)); user_id (rep who scheduled it (users.id)); number_id (sending number (numbers.id)); body (message text); send_at (when it sends (UTC)); sent_at (when it was sent (UTC)); is_error (1 when sending failed); created_at (created (UTC))

  • notes: Notes on leads. Default date column: created_at. Columns: id (note id); lead_id (lead (leads.id)); call_id (call (calls.id)); user_id (author (users.id)); content (note text); created_at (created (UTC))

  • activities: The lead timeline: every event recorded against a lead. Default date column: created_at. Columns: id (id); lead_id (lead (leads.id)); user_id (user involved (users.id)); call_id (call (calls.id)); action (event type); actor (who did it); interface (where it happened (web, app, api, …)); message (description); created_at (created (UTC))

  • users: Everyone with a login on the account (owners, admins, managers, agents). Default date column: created_at. Columns: id (user id); fname (first name); lname (last name); email (email); role (owner, admin, manager or agent); phone_number (phone number calls ring); timezone (timezone); is_online_web (1 when online in the browser); is_online_app (1 when online in the desktop app); is_online_mobile_app (1 when online in the mobile app); donotdisturb (1 when on do-not-disturb); last_login (last login (UTC)); last_called_at (last rung (UTC)); created_at (created (UTC))

  • teams: Teams: the ring groups leads are routed to, each with its own call settings. Default date column: created_at. Columns: id (team id); name (team name); call_mode (how reps are rung); sequence_id (follow-up sequence (sequences.id)); ai_agent_id (assigned AI agent (ai_agents.id)); fallback_id (fallback team (teams.id)); timezone (team timezone); language (whisper language); is_record (1 when calls are recorded); is_ai_call_submitted (1 when the AI calls new leads); is_ai_call_after_hours (1 when the AI calls after hours); is_ai_call_follow_ups (1 when the AI places follow-ups); is_ai_call_after_retries (1 when the AI calls after human retries run out); created_at (created (UTC))

  • team_members: Which users are on which team. Default date column: created_at. Columns: profile_id (team (teams.id)); user_id (member (users.id)); priority (ring priority); cap (daily lead cap)

  • ai_agents: AI voice agents configured on the account. Default date column: created_at. Columns: id (agent id); name (name the agent introduces itself with); description (internal description, never told to the lead); company (company it speaks for); is_voicemail (1 when it leaves voicemails); created_at (created (UTC))

  • sequences: Automated call + SMS follow-up sequences. Default date column: created_at. Columns: id (sequence id); name (name); created_at (created (UTC))

  • numbers: Phone numbers the account owns. Default date column: created_at. Columns: id (number id); name (label); phone_number (E.164 number); type (number type); team_id (team inbound calls route to (teams.id)); routing (inbound routing mode); is_record (1 when calls are recorded); is_dispatch (1 when used as a dispatch caller ID); ai_voice_agent_id (AI agent answering inbound calls (ai_agents.id)); ai_sms_agent_id (AI agent answering texts (ai_agents.id)); created_at (created (UTC))

  • tags: Lead tags. Default date column: created_at. Columns: id (tag id); name (name); is_cancel_calls (1 when tagging a lead cancels its calls); created_at (created (UTC))

  • lead_tags: Which tags are on which leads. Default date column: created_at. Columns: lead_id (lead (leads.id)); tag_id (tag (tags.id)); created_at (tagged (UTC))

  • stages: Pipeline stages. Default date column: created_at. Columns: id (stage id); name (name); order (position in the pipeline); close_percent (close probability); is_funnel (1 when shown in the funnel)

  • integrations: Connected lead sources and CRMs. Default date column: created_at. Columns: id (integration id); profile_id (team leads route to (teams.id)); platform (platform (e.g. hubspot, followupboss, zapier)); name (label); status (connection status); is_installed (1 when installed); created_at (created (UTC))

Input Schema

NameRequiredDescriptionDefault
limitNoMax rows, up to 200. Default 50.
selectNoColumns to return when listing rows.
date_toNoYYYY-MM-DD, inclusive, account timezone.
filtersNo
group_byNo
order_byNo
resourceYes
date_fromNoYYYY-MM-DD, inclusive, account timezone.
order_dirNo
aggregatesNo
date_fieldNoDate column the date range applies to; defaults to the resource's date column.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true, so the description carries most of the weight and does so well: it discloses the row cap (max 200, default 50), timezone conversion behavior for buckets, inclusive date semantics, and warns that transcript is long and should be selected for only a few calls. It omits pagination/offset behavior beyond the limit cap, which is the main residual gap.

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?

The prose portion is front-loaded and tightly organized: modes first, then dates, then group_by/aggregates/filters/order_by, then resources. The resource/column catalog is very long, but each entry is dense and load-bearing — though it dominates the description and could reasonably be split out for readability.

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?

No output schema, yet the description explains the return shape (JSON rows, aggregate columns named avg_seconds, single summary row). With 11 parameters, 18 resources and a large column catalog, it supplies everything an agent needs: cross-resource id semantics, a 'group by a column to learn its values' strategy, and per-resource default date columns.

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

Parameters5/5

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

Schema coverage is only 45%, but the description compensates thoroughly — filter object shape and the full op list, values vs value for in/not_in, bucket:column syntax with all bucket enumerations, function:column aggregate syntax with output naming (avg_seconds), order_by accepting aggregate output names, date_field overriding the default date column. Nearly every parameter gains meaning beyond 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 and resource ('Read this account's data. Returns JSON rows') and immediately scopes it to counts, breakdowns and lists across leads, calls, texts, reps and teams. It explicitly distinguishes itself from siblings by naming query_reports, search_leads, get_lead and get_recording with the conditions that select each.

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 explicit routing rules ('Prefer the specialised tools where one fits') plus a per-alternative rationale. It also spells out the two operating modes and when each applies — list rows when you supply select/filters/order_by/limit, aggregate when you supply group_by/aggregates, one summary row with aggregates alone.

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