Skip to main content
Glama

query_for_goal

Maps a natural-language goal to a bounded GraphQL query against registry entities, returning rationale, confidence, alternatives, or null when no confident match exists.

Instructions

Turn a goal into a bounded, goal-specific GraphQL query: maps intent (pool ids, swaps, candles/OHLCV, daily/hourly data, positions, liquidations, tokens, addresses, time ranges, latest/top) to a deployment entity from the registry's crawled entity names, with rationale, confidence, unmet parts and ranked alternatives. Returns query:null instead of a misleading query when no entity maps confidently; goals without entity intent get the stored starter labelled generic. Keyless default makes NO network call. validate_schema=true (your own Studio key) adds ONE scoped introspection request per deployment to confirm fields/arguments, typed ordering/filters and serving freshness; execute=true adds ONE gateway POST. If the chosen deployment times out, has failing indexers or is stale, it is skipped (reported in goal_mapping.skipped_deployments) and the next deployment that fits the goal is tried: at most 3 deployments and 6 gateway requests, never x402. Reward/curation status is not treated as unhealthy. Token/pool results are checked for likely spam (URL/lure names, implausible TVL, TVL without volume, low activity): flagged rows are reported in token_quality and, by default, moved after the others; nothing is removed. Without a key, onboarding explains the human-operator key setup.

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": {
      "goal": "<goal>"
    },
    "name": "query_for_goal"
  }
}

Input Schema

NameRequiredDescriptionDefault
goalYes
chainNo
firstNoRows to request; defaults to a number in the goal (e.g. top 3) or 5
executeNoExplicit opt-in to spend a Studio gateway query; never auto-pays x402
spam_handlingNoToken/pool rows: flag likely spam and move flagged rows last (default), only flag, or disable. Rows are never removed.flag_and_push_down
include_deniedNoAlso consider deployments with denied indexing rewards (not proof of unavailability) for entity matching
trusted_tokensNoExtra known-good token addresses never flagged as spam (adds to a small built-in per-chain allowlist)
validate_schemaNoOpt-in: with your own Studio key, one scoped live introspection request validates the generated fields/arguments before any execution
include_unservedNoAlso consider deployments with zero active allocations in the snapshot (not a queryability test)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.13.7

TDQS

A3.9/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so unusually well: it discloses the keyless no-network default, the one-introspection and one-POST costs of validate_schema/execute, the fallback policy (skip timed-out/stale deployments, max 3 deployments and 6 gateway requests, never x402), and the spam-flagging behavior with its never-remove guarantee. It also names the report fields (goal_mapping.skipped_deployments, token_quality) so the agent knows what to expect.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded and there is little filler, but the whole definition is a single semicolon-chained run-on paragraph that mixes purpose, cost model, fallback policy, and spam logic without breaks. The density makes it hard to scan for the specific constraint an agent needs at call time.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 9-parameter tool with no annotations and no output schema, the description covers the important ground: cost model, fallback limits, spam handling, and the shape of the returned mapping. It stops short of describing the query/result payload or what a 'generic' fallback contains in detail, which is a minor gap given the lack of an output schema.

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 78%, so the schema already documents most parameters, but the description adds real meaning beyond it: it explains that 'first' defaults to a number parsed from the goal, that execute is an explicit spend opt-in that never auto-pays x402, and that spam_handling can be flag-only or disabled without removing rows. It reinforces include_denied/include_unserved semantics rather than merely restating them.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource — turning a goal into a bounded, goal-specific GraphQL query — and enumerates the intent categories it maps (pools, swaps, candles, positions, liquidations, tokens, time ranges). It is clear what the tool does, but it never names a sibling (e.g. recommend_subgraph or search_subgraphs) to contrast against, so differentiation is left to the agent.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied rather than spelled out: the description explains that goals without entity intent fall back to a generic starter and that validate_schema/execute are opt-in steps, which gives the agent conditions for escalating. However, there is no explicit 'use this instead of X when…' routing against the registry-search siblings, so the when-not guidance is absent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.