Skip to main content
Glama

combine_queries

Boolean set algebra over the results of two or more VFB queries, compared on term ID. USE THIS INSTEAD OF RUNNING THE QUERIES SEPARATELY AND INTERSECTING THEM YOURSELF — the operands are often hundreds or thousands of rows each, so doing it by hand is both slow and a common source of wrong answers. Answers questions of the form "which neurons are in both X and Y", "in X but not Y", "in either but not both". Operators: AND OR NOT XOR NAND NOR XNOR, unary NOT, brackets, symbol aliases (& | - ^) and plain-English aliases ("but not", "in both", "either but not both"). Precedence loosest-first: OR/NOR, then XOR/XNOR, then AND/NAND/NOT, all left-associative. The response explains itself — as_read gives the grouping actually parsed, plain_english reads the whole expression back, steps traces the size of every intermediate set, and warnings flag the three ways a combination is silently wrong (a truncated operand, two sides in different ID namespaces, a complement against an implicit universe). ALWAYS CHECK as_read AGAINST WHAT THE USER ASKED before reporting the answer; use explain_only=true to see the parse for free before spending a query. Query-type operands must name a real query_type — get it from get_term_info's Queries array for the term in question, exactly as for run_query.

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": {
      "expr": "<expr>",
      "operands": "<operands>"
    },
    "name": "combine_queries"
  }
}

Input Schema

NameRequiredDescriptionDefault
exprYesThe boolean expression over your operand names, e.g. "calyx AND lh", "calyx but not lh", "(a OR b) AND NOT c". Max 2000 characters.
limitNoRows to return (default 25). count is always the true size of the result set. There is no offset — raise limit, or pass 0 for every row, only on a result you already know is small.
operandsYesNamed sets referenced by expr. Each value takes one of three forms: "<QueryType>:<id>" to run a query (e.g. "NeuronsPartHere:FBbt_00007401" — any run_query query_type), "search:<text>" for a free-text search, or "ids:<id>,<id>" for a literal set (useful for a list from a paper or the ids of a previous combine). Max 12 operands.
universeNoOptional operand spec, same three forms, defining what "everything" means for a complement (NOT, NAND, NOR, XNOR). Defaults to the union of the operands in the expression, because VFB holds around 750,000 terms and returning most of them is never the intended answer.
explain_onlyNoParse and explain the expression without running any query (default false). Returns as_read, plain_english and the universe note in well under a kilobyte. Use it to confirm the grouping of anything more complicated than a single operator before spending real work.
include_imagesNoInclude the thumbnail column (default false — it is stripped to save space; on a 220-row result it is the difference between 428 KB and 9.5 KB).
require_completeNoFail rather than answer if any operand was truncated (default false). A set operation over a truncated operand is silently wrong, so set this when the answer matters more than getting one.

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?

With no annotations, the description carries the full burden and does so: it discloses precedence and associativity, the response fields (as_read, plain_english, steps, warnings), the three silent-wrongness modes, that limit has no offset and count is always the true size, that include_images is stripped for size, and that require_complete converts truncation into failure. This is behavior an agent cannot get from the schema alone.

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-loads the what and the why-not-do-it-yourself, then proceeds to operators, precedence, response, and workflow — a sensible order with no filler sentences. It is dense and long, and a couple of parameter behaviors are repeated from the schema descriptions, plus the all-caps emphasis is heavier than needed.

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?

There is no output schema, so the description compensates by naming and explaining every returned field and what to check in them. For a 7-parameter, nested-object, expression-parsing tool with no annotations, this covers the parse semantics, failure modes, and safety checks an agent needs to call it correctly.

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: operator precedence (OR/NOR < XOR/XNOR < AND/NAND/NOT, left-associative), supported alias forms, and the rationale for universe defaulting to the union rather than VFB's ~750,000 terms. Some parameter detail (explain_only, require_complete, include_images) is restated rather than extended, which keeps it off a 5.

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 operation on a specific resource: boolean set algebra over the results of two or more VFB queries, compared on term ID, with the supported operators enumerated. It explicitly distinguishes itself from the sibling-path alternative (running queries separately and intersecting by hand) and names the concrete question shapes it answers.

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 negative directive ("USE THIS INSTEAD OF RUNNING THE QUERIES SEPARATELY...") with the reason (operands are large; hand intersection is slow and wrong-prone), plus a pre-flight workflow: use explain_only=true to check the parse for free, and ALWAYS CHECK as_read against the request. It also tells the agent where query_type operands come from (get_term_info's Queries array, as with run_query).

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.