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, linkedin_slug, linkedin_provider_id, email. Filter by list with "list_name = 'oil-gas'". identifier is the key the row was saved under — a company's domain; for a person, whichever LinkedIn handle or email its source had. A person's LinkedIn profile slug, provider id and email are in linkedin_slug, linkedin_provider_id and email, read from the linked person ('' when the row isn't linked or the person has none). 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, company, degree or connector, use list_people instead. For the agent's companies as its Companies tab shows them, one row per company with its lists, verdict and signals rolled up across rows, or counted by list or source, use list_companies.

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. 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, linkedin_slug, linkedin_provider_id, email, columns, created_at}), plus connections_coverage {you, team_missing}. columns is the normalized [label, value] projection of the row's agent-researched data.columns.

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>"
    },
    "name": "query_search_results"
  }
}

Input 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).
order_byNoSQL ORDER BY (default: created_at DESC).created_at DESC
on_behalf_ofNoA teammate's email, or an agency client's from list_agency_clients, to run this call in that 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 the rows marked rejected. Default False.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / properties / group_by
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "enum": [
      -        "list",
      -        "source",
      -        "company"
      -      ],
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "description": "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."
      -}
    • changedInput schema / properties / include_rejected / description
      Previous value: -"Also return (and count) the rows marked rejected. Default\nFalse."New value: +"Also return the rows marked rejected. Default False."
  2. Changed1 schema field changed
    • changedInput schema / properties / on_behalf_of / description
      Previous value: -"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."New value: +"A teammate's email, or an agency client's from list_agency_clients, to run this call in that account: their agents, settings, connected accounts, and credits. Omit it to act on your own account."
  3. 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"
      +  }
      +]
  4. 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."
      +}
  5. 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."
  6. 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."
      +}
  7. 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."
  8. 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."
      +}
  9. 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"
      +]
  10. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only supply readOnlyHint=true, but the description goes far beyond: rejected rows are silently excluded unless verdict='rejected', include_rejected or run_id is passed, so a where_clause on verdict alone never reaches them. It also discloses the connection_status overlay injected into matched person rows, the connections_coverage block, that missing JSON paths yield NULL and NULL comparisons drop rows, and that the viewer is the agent owner.

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?

Purpose is front-loaded before column enumeration, and each paragraph covers a distinct concern (columns, verdicts, FKs, data shape, overlay). It is long and dense — the tables/verdict paragraph is a single sprawling sentence — but nearly every clause carries decision-relevant information for a 9-parameter SQL-like tool.

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?

Despite no output schema, the embedded <returns> block specifies the response shape (count, truncated, items, columns, connections_coverage). Combined with the data-shape warning, the rejected-row default, and sibling routing, nothing an agent needs to call this correctly is missing.

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 baseline is 3, but the description adds real meaning: the interaction between include_rejected/run_id/verdict and the default view, what `identifier` actually holds per entity type (domain vs LinkedIn handle vs email), and that linkedin_slug/linkedin_provider_id/email are read through the linked person. It says little extra about limit/offset/order_by/on_behalf_of beyond the already thorough 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?

First sentence names a specific verb and resource ('Query the agent's entity row store (`agent_search_results`)') and enumerates which sources populate it. It then distinguishes itself from siblings by naming query_people, query_companies, list_people and list_companies with the exact conditions that select each. An agent can route to the right tool without opening any schema.

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 when-to-use/when-not-to-use: use list_people for LinkedIn degree and warm-intro connectors, list_companies for rolled-up company views, query_people/query_companies for linked-record firmographics. It also prescribes a workflow ('Read a page of rows without a `data` filter first, then filter against the shape you see') and warns that a filter on the wrong data shape returns a false miss.

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