Skip to main content
Glama
treasure-data

Treasure Data MCP Server

Official

segment_sql

Retrieves the SQL statement for a specific segment by applying its filtering conditions to the parent audience SQL. Provide parent_segment_id and segment_id after finding IDs with the list tools.

Instructions

[EXPERIMENTAL] Get the SQL statement for a segment with filtering conditions applied to the parent segment (audience) SQL. Requires both parent_segment_id and segment_id parameters. Use list_parent_segments and list_segments first to find available IDs.

Input Schema

NameRequiredDescriptionDefault
segment_idYesThe segment ID (required). Use list_segments to find available IDs under the parent segment.
parent_segment_idYesThe parent segment ID (required). Use list_parent_segments to find available IDs.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the burden well: it marks the tool as EXPERIMENTAL and clarifies that it returns a SQL statement with filtering conditions applied rather than executing anything. It omits permission or failure behavior, but for a simple retrieval tool this is reasonably transparent.

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?

The description is front-loaded with the experimental status and core purpose, followed by requirements and prerequisite tools. It is efficient, though the required-parameter sentence partly repeats what the schema already enforces.

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 two-parameter retrieval tool with fully described schema fields and no output schema, the description covers purpose, required inputs, and how to obtain IDs. It could more explicitly contrast with parent_segment_sql, but otherwise it is complete enough to invoke correctly.

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 both parameters are already documented in the schema, including the sibling lookup tools. The description reinforces that both IDs are required but adds no syntax or semantic detail beyond the structured fields.

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?

The description states a specific verb and resource: get the SQL statement for a segment with filtering conditions applied to the parent segment SQL. It clearly distinguishes this from retrieving the parent segment SQL alone, which helps an agent separate it from sibling parent_segment_sql.

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

Usage Guidelines4/5

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

It gives clear prerequisite guidance by naming list_parent_segments and list_segments to find the required IDs. It does not explicitly state when to prefer this over parent_segment_sql, so it stops short of full alternative routing.

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