Skip to main content
Glama

te_query_sql

Execute SQL queries against project-specific ThinkingEngine event and user tables via WebSocket, returning the results.

Instructions

Execute a SQL query via WebSocket and return results

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": {
      "projectId": "<projectId>",
      "sql": "<sql>"
    },
    "name": "te_query_sql"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL query string. Tables: ta.v_event_{projectId}, ta.v_user_{projectId}
hostNoTE system host (e.g. ta.thinkingdata.cn). Defaults to TE_HOST env var.
projectIdYesProject ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.1

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full burden. It discloses only the transport ('via WebSocket'), which is an implementation detail of little use to an agent. It says nothing about whether writes/DDL are permitted, required permissions, row limits, timeouts, or the shape of the returned results for a tool that executes arbitrary SQL.

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?

A single front-loaded sentence with no filler or redundancy. It is efficient, though its brevity is part of why behavior and usage remain under-specified.

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

Completeness2/5

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

Executing arbitrary SQL against a project's analytics store is a high-consequence, complex operation with no annotations and no output schema. The description should at minimum cover read-only expectations, result limits, and error behavior; it covers none of these, leaving the agent under-informed before invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all three parameters (sql, projectId, host) are already documented, including the ta.v_event_{projectId} table convention. The description adds nothing beyond that, so the baseline of 3 applies.

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: 'Execute a SQL query ... and return results'. That is unambiguous about what the tool does. It does not, however, differentiate itself from data-fetching siblings like te_query_report_data or te_list_tables, so an agent must infer that this is the raw-SQL escape hatch.

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

Usage Guidelines2/5

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

There is no when-to-use guidance, no mention of when to prefer this over the many structured query/list siblings, and no stated prerequisites or restrictions. The agent is left to guess whether arbitrary SQL is allowed or whether this is a fallback for cases the other tools cannot cover.

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