Skip to main content
Glama

generate_unit_test

Read-onlyIdempotent

WHEN: developer needs to write or scaffold unit tests for a custom D365 object. Triggers: 'generate tests', 'unit test', 'SysTest', 'write test for', 'scénarios de test', 'test this class'. Generate X++ SysTest unit test code for a CUSTOM D365 F&O object based on functional test scenarios. [!] Only meaningful on custom/extension code (D365_CUSTOM_MODEL_PATH). SysTest tests in D365 are highly context-specific -- a generic template rarely compiles without adaptation. REQUIRED: provide test scenarios in the 'testScenarios' parameter (supplied by the functional consultant). Each scenario becomes a concrete test method with arrange/act/assert. For tables: generates tests for find(), exist(), validateWrite(), initValue(). For classes: generates stubs for each public method listed in scenarios. Uses REAL field names and method signatures from the knowledge base.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNameNoOptional: specific method to test. If not provided, generates tests for all testable methods.
objectNameYesObject name to generate tests for, e.g. 'ALMERSftpConnectionTable', 'ALMMyClass'
sampleValuesNoOptional: JSON object mapping field name to sample value used in each ARRANGE block, e.g. '{"AccountNum":"C0001","Amount":1500.50}'. Replaces the 'TODO: set up test data' placeholders with concrete assignments.
testScenariosNoTest scenarios provided by the functional consultant, e.g. 'Create a connection with valid SFTP host; Validate that empty host fails; Delete cleans up related records'. Separate scenarios with semicolons.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / sampleValues
      Added value: +{
      +  "default": null,
      +  "description": "Optional: JSON object mapping field name to sample value used in each ARRANGE block, e.g. '{\"AccountNum\":\"C0001\",\"Amount\":1500.50}'. Replaces the 'TODO: set up test data' placeholders with concrete assignments.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / objectName / description
      Previous value: -"Object name to generate tests for, e.g. 'HSOERSftpConnectionTable', 'HSOMyClass'"New value: +"Object name to generate tests for, e.g. 'ALMERSftpConnectionTable', 'ALMMyClass'"
  3. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds genuine behavioral context beyond that: it warns that 'a generic template rarely compiles without adaptation' (managing expectations about output quality), discloses data provenance ('Uses REAL field names and method signatures from the knowledge base'), and specifies generation behavior per object type. No contradiction with annotations exists.

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?

Well front-loaded: WHEN and triggers come first, then the core purpose, then constraints, then parameter guidance. The trigger list is slightly redundant with the WHEN clause but serves agent intent-matching, and every sentence carries information. A bit long, but no wasted words given the complexity being conveyed.

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 4-parameter tool with no output schema, the description covers the essential ground: when to use, what input is required, what the generated output looks like (arrange/act/assert, per-type method generation), and key constraints (custom-only, adaptation likely needed). The only notable gap is the output delivery format (inline code vs. file), which is minor given how much else is specified.

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 meaningful value above the schema: it flags testScenarios as REQUIRED even though the schema's required array only lists objectName, explains that each scenario becomes a concrete arrange/act/assert test method, and clarifies type-specific output (find/exist/validateWrite/initValue for tables vs. public-method stubs for classes). This materially aids correct invocation.

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 uses a specific verb and resource: 'Generate X++ SysTest unit test code for a CUSTOM D365 F&O object based on functional test scenarios.' The 'CUSTOM' qualifier and the explicit 'SysTest' method clearly separate it from siblings like generate_data_entity, generate_query, and generate_xpp_form. The scope is unambiguous.

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?

Provides an explicit WHEN clause ('developer needs to write or scaffold unit tests for a custom D365 object'), a concrete trigger-phrase list ('generate tests', 'unit test', 'SysTest', etc.), and a usage exclusion ('Only meaningful on custom/extension code'). It stops short of naming alternative tools for the when-not case, but the context is clear and actionable.

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.