Skip to main content
Glama

generate_object

Generate X++/AOT code for D365 F&O: pattern skeletons, whole-object scaffolds, and table helpers for find methods, relations, and fields.

Instructions

Generate X++/AOT code. Choose a mode: • pattern → a named X++ skeleton from the pattern enum (text only, no write). Call analyze_code(mode="patterns") first, then generate_object(mode="pattern"), then d365fo_file(action="create"). • scaffold → pattern-aware whole-object generation (table/form/report) with intelligent field/index/relation or form-pattern suggestions; set objectType. • find-methods → find()/findRecId()/exists() for a table (text), keyed on its primary/unique index. • relation-xpp → a table's relation(s) → X++ select + QueryBuildRange (text). • fields → field names → AxTableField XML with auto-resolved EDTs + optional field group. • table-relation → EDT-referencing fields → AxTableRelation XML (inverse of relation-xpp). 📖 Mode parameters are NOT inlined here: get_knowledge(kind="op-spec", topic="") — "scaffold:table"/"scaffold:form"/"scaffold:report" for the scaffolds — returns the contract; pass its values nested in params. For a single existing object definition's XML use d365fo_file(action="generate") instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYespattern = X++ skeleton; scaffold = whole table/form/report (set objectType); find-methods/relation-xpp/fields/table-relation = X++/XML helpers for an existing table.
nameNoREQUIRED. [pattern] element name (extensions: base element; form-datasource/control-extension: the FORM name). [scaffold] object name WITHOUT model prefix. [other modes] the existing table.
paramsNoMode-specific parameters as ONE nested object (label, fields[], fieldsHint, cloneFrom, tableMapping, formPattern, contractParams[], keyFields[], style, fieldGroup, …). Get the contract from get_knowledge(kind="op-spec", topic="<mode>"); a missing required one returns that COMPLETE spec.
patternNo[pattern] REQUIRED. CoC skeletons: class/table-extension, form-handler, form-datasource-extension, form-control-extension, map-extension. ssrs-report-full = Contract+DP+Controller; service-class-ais = CRUD service + contract.
modelNameNoModel name (auto-detected). NEVER use placeholders like "MyModel".
objectTypeNo[scaffold] REQUIRED. Kind of object to generate.
Behavior4/5

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

Annotations already signal readOnlyHint=false and destructiveHint=false, so the tool may have side effects. The description adds valuable context by explicitly marking 'pattern' mode as 'text only, no write' and by instructing the agent to fetch mode-specific contracts via get_knowledge before invoking, which sets expectations about parameter discovery. It also mentions that a missing required param returns the complete spec (via schema param description), but the main description does not fully clarify whether scaffold modes write files or just return code, leaving slight ambiguity.

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 structured as a clear bulleted list of modes, and each sentence earns its place by explaining one mode or a workflow step. It is a bit long (six bullets plus two paragraphs of guidance), but the density of information justifies the length. The front-loaded first sentence immediately states the tool's purpose.

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?

Given the tool has six parameters, a nested object, and no output schema, the description covers the main invocation context: it lists all modes, tells how to obtain mode contracts, and mentions the alternative d365fo_file for generating XML. It does not explicitly describe the return format for scaffold or XML modes, but the lack of an output schema makes this less critical, and the description does provide enough context to select and invoke the tool 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 the schema already defines each parameter with enums and per-field descriptions. The description's main added value is telling the agent that mode-specific parameters are NOT inlined and must be retrieved via get_knowledge(kind='op-spec', topic='<mode>'), which is important for correct invocation. However, it does not add further meaning beyond what the schema already provides; per calibration, 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?

The description opens with a specific verb+resource: 'Generate X++/AOT code.' It then enumerates six distinct modes, each with a concise purpose, which clearly differentiates the tool from alternatives like d365fo_file (used for XML generation). The inclusion of mode-specific behaviors (e.g., 'text only, no write') removes ambiguity about what each invocation does.

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?

The description explicitly tells the agent when to use this tool versus alternatives: call analyze_code(mode='patterns') first, then generate_object(mode='pattern'), then d365fo_file(action='create'). It also states to use d365fo_file(action='generate') for existing object XML instead. This provides clear, actionable usage context.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dynamics365ninja/d365fo-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server