Skip to main content
Glama

generate_query

Read-onlyIdempotent

WHEN: developer needs correct X++ select or T-SQL for D365 tables with proper joins. Triggers: 'X++ select', 'generate a query', 'SQL for', 'join with', 'how to query', 'générer une requête', 'write a select statement', 'select from', 'X++ query for', 'requête X++', 'écrire une select'. Generate both X++ select statements and equivalent T-SQL queries for D365 F&O tables. Uses real field names, relations, and indexes from the knowledge base to produce correct joins. Supports: field selection, multi-table joins (auto-detects relations), WHERE filters, ORDER BY, TOP/firstonly, cross-company. Also accepts natural language descriptions like 'find all open sales orders for customer 1001 with CustTable join'. [!] For multi-table joins, call find_related_objects (or get_relation_graph if the relation index is loaded) FIRST to get the correct FK relations -- this tool will then produce accurate join conditions. [!] The generated X++ is a template -- adapt it to your custom code context before using in production. Returns side-by-side X++ and SQL with explanations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNoOptional: limit rows (1 = firstonly, N = top N)
fieldsNoOptional: specific fields to select (comma-separated). All fields if not specified.
filtersNoOptional: WHERE filter expressions (comma-separated), e.g. 'CustAccount == 1001, SalesStatus == SalesStatus::Open'
orderByNoOptional: field to ORDER BY
tableNameYesPrimary table name, e.g. 'SalesTable', 'CustTable'
joinTablesNoOptional: tables to join (comma-separated), e.g. 'CustTable,SalesLine'
descriptionNoOptional: natural language description of the query. If provided, fields/joins/filters are auto-detected.
crossCompanyNoWhether to add crosscompany clause (default: false)

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already mark the tool readOnly and idempotent, and the description adds substantial behavioral context beyond that: it 'uses real field names, relations, and indexes from the knowledge base', returns 'side-by-side X++ and SQL with explanations', and explicitly states the generated X++ is 'a template -- adapt it to your custom code context before using in production.' This goes well beyond the annotations and helps the agent set correct expectations.

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 longer than average, but the length is justified by trigger phrases, capability list, and critical usage caveats. It is front-loaded with the WHEN clause and important notes. It could be tightened slightly by trimming some redundant trigger examples, but every major section earns its place.

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 a tool with 8 parameters, no output schema, and readOnly/idempotent annotations, the description covers what is needed to call it correctly: capabilities, parameter interactions via natural language, join dependency on find_related_objects, output format, and production-readiness caveat. Nothing critical is missing.

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 the input schema already documents all 8 parameters. The description summarizes capabilities such as 'multi-table joins (auto-detects relations)', 'WHERE filters', 'ORDER BY', 'TOP/firstonly', and 'cross-company', but it does not add deeper syntax or format details beyond the schema. Baseline 3 is appropriate.

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?

Description states a specific verb and resource: generate 'X++ select statements and equivalent T-SQL queries for D365 F&O tables'. It clearly distinguishes from siblings like generate_xpp_template or generate_data_entity by focusing on query generation with real field names, relations, and indexes.

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?

Provides explicit WHEN triggers like 'X++ select', 'generate a query', 'SQL for', and 'join with', making it clear when this tool is intended. It also gives a mandatory precondition for multi-table joins: 'call find_related_objects (or get_relation_graph if the relation index is loaded) FIRST' — strong routing and sequencing guidance, plus a warning to adapt generated X++ before production use.

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.

TDQS

A4.1/5.0
Disambiguation4/5

Most tools have distinct purposes and clear triggers, reducing ambiguity. For example, PR-related tools are separated into analysis, listing, commenting, and dependency mapping. However, some overlap exists between find_references, find_extensions, and find_callers, which could confuse an agent without careful descriptions.

Naming Consistency4/5

Tool names follow a consistent snake_case pattern with verb_noun structure within subgroups (e.g., ado_*, find_*, search_*, generate_*). There is no mixing of camelCase or other styles, though the variety of prefixes slightly reduces predictability.

Tool Count3/5

With 38 tools, the server feels slightly over-scoped for its domain. While each tool has a specific function, the number is high compared to typical well-scoped servers (10-15 tools). Some tools like find_references and find_callers could be consolidated.

Completeness4/5

The tool set covers a broad range of D365 F&O development and DevOps tasks, including code search, analysis, security, performance, upgrades, and work item management. Minor gaps exist, such as the absence of direct object modification or batch job management, but the core workflows are well covered.