Skip to main content
Glama

Query Search Results

query_search_results
Read-only

Columns: id, agent_id, entity_type, list_name, source, identifier, display_name, verdict, verdict_reason, data (JSONB), created_at, person_id, company_profile_id. Filter by list with "list_name = 'oil-gas'". source is the discovery tool that surfaced the row ('agent' when no discovery tool did; 'legacy' for rows older than the column). verdict is the curation call recorded on the row with record_search_results, or by the check a search tool, a post monitor's engager capture or a Websets list runs on the rows it saves — 'qualified', 'rejected', 'unclear' for a row screened but too thin to judge, or NULL for a row not yet screened — with verdict_reason saying why. Rejected rows are left out unless you pass verdict='rejected', include_rejected or run_id, the same as the user's default view, so a where_clause on verdict alone never reaches them.

person_id / company_profile_id are the canonical person / company FK ids (NULL until the row is linked). A person's profile (title, company) and a company's firmographics (industry, location, employee count, description) — the values the agent's People and Companies tabs show — live on the linked record, not in the row's own data: read them with query_people / query_companies on those ids, and filter on them through the id, e.g. "company_profile_id IN (SELECT id FROM research_app_company_profiles WHERE industry ILIKE '%oil%')". For a person's LinkedIn degree and warm-intro connectors, or the agent's people counted by list, source, degree or connector, use query_agent_people instead.

data has no single schema — its shape follows whichever source wrote the row (it is the agent-authored blob). Most person rows nest under person (data->'person'->>'position', data->'person'->'company'->>'name') and most company rows under company (data->'company'->>'name'), but other sources write those fields flat. A path that doesn't exist yields NULL rather than an error, and a NULL comparison drops the row — so a filter aimed at the wrong shape comes back empty or short and reads as a genuine miss. Read a page of rows without a data filter first, then filter against the shape you see.

Person rows are annotated with the team connection overlay (mirrors the Find UI): a matched row's data gains connection_status: {you: bool, teammates: [{email, name, first_name}]} naming the viewer/teammates who are 1st-degree to that prospect; unmatched rows and company rows carry no such key. A top-level connections_coverage: {you: 'none'|'partial'|'csv_uploaded', team_missing: int} reports the owner's own connection coverage and how many active teammates still lack a CSV upload. The viewer is the agent owner. In row mode (group_by omitted) — a dict with count, truncated, and items array (each row {id, agent_id, entity_type, list_name, source, identifier, display_name, verdict, verdict_reason, data, person_id, company_profile_id, columns, created_at}), plus connections_coverage {you, team_missing}. columns is the normalized [label, value] projection of the row's agent-researched data.columns. In aggregate mode (group_by set) — a dict {group_by, groups} where groups is a list of {key, count, qualified, rejected, unclear, unscreened} ordered by count descending. count is every row the call counts, and the other four split it by verdict (unscreened: no verdict yet); rejected rows are ones the screen ruled out, not matches. With group_by "list", each group also carries criteria: the search criteria a Websets list screens its rows against, '' for any other list.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum results (default 50, max 200).
offsetNoRows to skip for paging (default 0). When the result is truncated, re-call with offset += limit for the next page.
run_idNoOnly the rows whose person or company this search run returned, rejected ones included, on the list it saved to (an `id` from `query_search_runs`). Omit for every row.
verdictNoOnly the rows with this verdict, 'qualified', 'rejected' or 'unclear' ('rejected' reads the rows the user's default view filters out). Omit for every verdict.
agent_idYesFilter to a specific agent (required).
group_byNoAggregate mode, returned instead of the row list — per-bucket counts over the whole agent (not truncated by the row cap). "list" buckets rows by list_name; "company" buckets people by employer; "source" buckets rows by the discovery tool that surfaced them. Omit for the row list.
order_byNoSQL ORDER BY (default: created_at DESC).created_at DESC
on_behalf_ofNoAn agency client's email, from list_agency_clients, to run this call in that client's account: their agents, settings, connected accounts, and credits. Omit it to act on your own account.
where_clauseNoSQL WHERE condition (default returns all rows for the agent). Examples: "data->'person'->>'position' ILIKE '%VP%'", "entity_type = 'person'", "list_name = 'oil-gas-operators'".1=1
include_rejectedNoAlso return (and count) the rows marked rejected. Default False.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / group_by / anyOf
      Previous value: -[
      -  {
      -    "enum": [
      -      "list",
      -      "company",
      -      "source"
      -    ],
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "list",
      +      "source",
      +      "company"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  2. Changed1 schema field changed
    • addedInput schema / properties / on_behalf_of
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "An agency client's email, from list_agency_clients, to run this call in that client's account: their agents, settings, connected accounts, and credits. Omit it to act on your own account."
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / run_id / description
      Previous value: -"Only the rows whose person or company this search run returned, rejected\nones included, on any list (an `id` from `query_search_runs`). Omit for every row."New value: +"Only the rows whose person or company this search run returned, rejected\nones included, on the list it saved to (an `id` from `query_search_runs`). Omit for\nevery row."
  4. Changed1 schema field changed
    • addedInput schema / properties / run_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Only the rows whose person or company this search run returned, rejected\nones included, on any list (an `id` from `query_search_runs`). Omit for every row."
      +}
  5. Changed2 schema fields changed
    • changedInput schema / properties / verdict / anyOf
      Previous value: -[
      -  {
      -    "description": "The agent's curation call on an `agent_search_results` row. NULL (no verdict) means\nunreviewed; the default task views hide only `REJECTED` rows.",
      -    "enum": [
      -      "qualified",
      -      "rejected"
      -    ],
      -    "title": "SearchResultVerdict",
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "description": "The agent's curation call on an `agent_search_results` row. NULL (no verdict) means not yet\nscreened; `UNCLEAR` means screened but too thin to judge. The default task views hide only\n`REJECTED` rows.",
      +    "enum": [
      +      "qualified",
      +      "rejected",
      +      "unclear"
      +    ],
      +    "title": "SearchResultVerdict",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / verdict / description
      Previous value: -"Only the rows with this verdict, 'qualified' or 'rejected' ('rejected'\nreads the rows the user's default view filters out). Omit for every verdict."New value: +"Only the rows with this verdict, 'qualified', 'rejected' or 'unclear'\n('rejected' reads the rows the user's default view filters out). Omit for every\nverdict."
  6. Changed2 schema fields changed
    • addedInput schema / properties / include_rejected
      Added value: +{
      +  "default": false,
      +  "description": "Also return (and count) the rows marked rejected. Default\nFalse.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / verdict
      Added value: +{
      +  "anyOf": [
      +    {
      +      "description": "The agent's curation call on an `agent_search_results` row. NULL (no verdict) means\nunreviewed; the default task views hide only `REJECTED` rows.",
      +      "enum": [
      +        "qualified",
      +        "rejected"
      +      ],
      +      "title": "SearchResultVerdict",
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Only the rows with this verdict, 'qualified' or 'rejected' ('rejected'\nreads the rows the user's default view filters out). Omit for every verdict."
      +}
  7. Changed6 schema fields changed
    • addedInput schema / properties / agent_id
      Added value: +{
      +  "description": "Filter to a specific agent (required).",
      +  "type": "integer"
      +}
    • changedInput schema / properties / group_by / anyOf
      Previous value: -[
      -  {
      -    "enum": [
      -      "list",
      -      "company"
      -    ],
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "list",
      +      "company",
      +      "source"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / group_by / description
      Previous value: -"Aggregate mode, returned instead of the row list — per-bucket counts\nover the whole task (not truncated by the row cap). \"list\" buckets rows by\nlist_name; \"company\" buckets people by employer. Omit for the row list."New value: +"Aggregate mode, returned instead of the row list — per-bucket counts\nover the whole agent (not truncated by the row cap). \"list\" buckets rows by\nlist_name; \"company\" buckets people by employer; \"source\" buckets rows by\nthe discovery tool that surfaced them. Omit for the row list."
    • removedInput schema / properties / task_id
      Removed value: -{
      -  "description": "Filter to a specific task (required).",
      -  "type": "integer"
      -}
    • changedInput schema / properties / where_clause / description
      Previous value: -"SQL WHERE condition (default returns all rows for the task).\nExamples: \"data->'person'->>'position' ILIKE '%VP%'\",\n\"entity_type = 'person'\", \"list_name = 'oil-gas-operators'\"."New value: +"SQL WHERE condition (default returns all rows for the agent).\nExamples: \"data->'person'->>'position' ILIKE '%VP%'\",\n\"entity_type = 'person'\", \"list_name = 'oil-gas-operators'\"."
    • changedInput schema / required
      Previous value: -[
      -  "task_id"
      -]New value: +[
      +  "agent_id"
      +]
  8. First observed

TDQS

A4.8/5.0
Behavior5/5

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

With only `readOnlyHint=true` from annotations, the description carries the burden and delivers: rejected rows are excluded unless `verdict='rejected'`, `include_rejected`, or `run_id` is passed; a `where_clause` on `verdict` alone never reaches them; non-existent `data` paths yield NULL and drop the row silently; the team connection overlay and `connections_coverage` keys are described. This is unusually rich disclosure of behavior beyond the annotation.

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 the core purpose and cleanly sectioned into `<summary>` and `<returns>`, with the columns list and shape warnings placed where they are needed. It is dense and long, and some verdict explanation overlaps the schema text, but nearly every sentence carries non-obvious operational detail.

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 10-parameter tool with no output schema, the description supplies the missing return contract (row mode vs aggregate mode, `columns` projection, group verdict breakdowns, `criteria` for list groups) plus the edge cases an agent would otherwise trip on. Nothing needed to call it correctly appears absent.

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 real meaning beyond it: `source` values ('agent' when no discovery tool surfaced the row, 'legacy' for old rows), `verdict` NULL vs 'unclear' semantics, `person_id`/`company_profile_id` FK purpose, and a concrete `where_clause` example. It stops short of documenting paging/limit behavior, which the schema already handles.

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 ("Query the agent's entity row store (`agent_search_results`)") and names the exact contents (people and companies recorded from discovery search, CRM reads, enrichment, pasted lists). It also distinguishes itself from siblings by name — `query_people`/`query_companies` for linked-record fields and `query_agent_people` for LinkedIn degree/connectors.

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?

Explicit routing to alternatives: linked-record fields via `query_people`/`query_companies` on the FK ids, and LinkedIn/warm-intro questions via `query_agent_people`. It also gives an actionable procedure for the tricky case — "Read a page of rows without a `data` filter first, then filter against the shape you see" — and explains the default-view behavior that hides rejected rows.

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