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 — 'qualified', 'rejected', or NULL for a row nobody reviewed — with verdict_reason saying why. Rejected rows are left out unless you pass verdict='rejected' or include_rejected, 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%')". A company row with no company_profile_id is an unidentified company and has none. For a person's LinkedIn degree and warm-intro connectors, or the agent's people counted by list, source, degree or connector, use query_task_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} ordered by count descending.

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.
verdictNoOnly the rows with this verdict, 'qualified' or 'rejected' ('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
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. 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."
      +}
  2. 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"
      +]
  3. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true, and the description goes well beyond that: it discloses that rejected rows are filtered by default, that a NULL path comparison silently drops rows and reads as a genuine miss, that person rows carry a team connection overlay plus connections_coverage metadata, and that data has no fixed schema. These are non-obvious behaviors an agent could not infer from the structured fields.

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 summary sentence, then columns, then behavioral caveats and routing — well ordered. It is long and the column enumeration plus overlay explanation is dense, but nearly every sentence carries information an agent needs to avoid empty/wrong results; only mild trimming would be possible.

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 an 8-parameter query tool with no output schema, the description supplies the return shape itself (row mode vs aggregate mode, columns projection, connections_coverage), the pitfalls, and the alternative tools. Nothing essential to correct invocation appears missing.

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 100% (baseline 3), but the description adds real semantics: verdict values are the curation call from record_search_results, rejected rows need include_rejected to surface, where_clause must reference the row's columns/FKs (with a subquery example against research_app_company_profiles), and data->'person'/'company' nesting varies by source. That is meaningfully more than the schema provides.

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?

Opens with a specific verb+resource and scope: query the agent's entity row store `agent_search_results` (people and companies from discovery, CRM, enrichment, pasted lists). It names the sibling tools it is not (query_people, query_companies, query_task_people), so an agent can route without opening schemas.

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 rules: profile/firmographic values live on linked records so read them via query_people/query_companies; for LinkedIn degree, warm-intro connectors, or counts by list/source/degree/connector use query_task_people instead. It also states the default-view behavior (rejected rows hidden unless verdict='rejected' or include_rejected) and the recommended workflow (read a page without a data filter first).

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