ado_post_comment
WHEN: user explicitly asks to post, add, or save a comment to an ADO Work Item. [~] PRIORITY TRIGGER: call AFTER `ado_analyze_workitem` when user says 'post the analysis', 'save it to the ticket', 'ajoute en commentaire'.
WARNING: ALWAYS ask for explicit user confirmation before calling this tool. Recommended workflow: (1) call `ado_analyze_workitem`, (2) show analysis to the user, (3) ask 'Shall I post this comment to Work Item #X?', (4) only then call this tool. Requires DEVOPS_ORG_URL + DEVOPS_PAT with Work Items: Write permission.
generate_diagram
WHEN: generating a visual diagram of D365 table relationships or security chains. Triggers: 'generate diagram', 'diagramme', 'visualize', 'schéma', 'ER diagram', 'entity-relationship', 'relation diagram', 'security diagram', 'show connections'. Generate visual Mermaid diagrams from D365 F&O knowledge base data. Diagrams render directly in Copilot Chat, Cursor, Claude, and markdown viewers. Types: 'er' (entity-relationship diagram for a table and its relations), 'security' (security chain: Role->Duty->Privilege->EntryPoints -- use when you need a VISUAL Mermaid diagram; for the structured text chain with tables of duties/privileges/entry-points use `trace_security_chain` instead). Note: 'flow' (execution flowchart) is disabled -- static call trees are misleading in D365 due to CoC and event handlers.
ado_analyze_pr_impact
[~] PRIORITY TRIGGER: Use this tool when the user says 'analyse PR', 'review PR', 'check PR', 'PR #', 'impact du PR', 'analyse la PR', 'what changed in PR', 'D365 impact of PR', 'code review PR', 'violations in PR', 'PR review'. NEVER call search_d365_code when 'PR' or 'Pull Request' + a number is mentioned. Analyse the full D365 F&O code impact of a Pull Request. For every X++ class/table/form/extension modified in the PR: (1) Best Practice validation -- reports Critical and Warning violations. (2) Upgrade impact -- cross-references CoC targets, event handlers, and extensions against the D365 standard code. (3) Extension conflicts -- finds existing CoC/extensions that may conflict. (4) Produces a ready-to-post PR review comment addressed to the PR author. After reviewing, call `ado_post_pr_comment` to post the review (requires user confirmation). Requires DEVOPS_ORG_URL + DEVOPS_PAT (Code: Read).
validate_best_practices
WHEN: code review, quality gate, or best-practice audit on ANY D365 F&O object (custom or standard). Triggers: 'vérifie les bonnes pratiques', 'check quality', 'code review', 'violations', 'best practices pour', 'audit du code', 'check this class', 'any issues in', 'vérifie cette classe', 'quality check', 'bonnes pratiques sur'. Checks: security vulnerabilities, performance issues, transaction problems, error handling, code quality. NOT for deep performance profiling (N+1 queries, row-by-row inserts) -- use detect_performance_issues for that. [!] Auto-fixing violations is only possible on YOUR custom code (D365_CUSTOM_MODEL_PATH). Standard D365 objects return read-only violation analysis.
get_object_details
WHEN: you know the EXACT object name. Triggers: user gives an exact name like 'SalesTable', 'CustTable', 'VendInvoiceJour', any PascalCase D365 object name. Get complete details: all fields, methods, relations, indexes, source code, and metadata. Also merges live disk source when a custom model path is configured (disk takes priority). Pass `methodName` to get the FULL body of a specific method -- without it, only signatures are returned. Calling twice -- first without methodName to get the full structure and method table, then again with a specific methodName for its full body -- is the CORRECT and INTENDED two-step pattern. Do NOT call a third time for the same object. NOT for searching -- use search_d365_code when the name is uncertain. NOT for listing a model's objects -- use list_objects for that.
healthcheck
WHEN: checking server status, loaded D365 version, or custom model path. Triggers: 'status', 'statut', 'is the server ready', 'how many chunks', 'index loaded'. Returns JSON with: status, indexed chunk count, loaded version, custom model path.
generate_fdd
WHEN: user asks to write or generate a Functional Design Document, FDD, functional spec, CdC, or cahier des charges. NOT for developer technical docs -- use `get_object_details` for that.
FUNCTIONAL DESIGN DOCUMENT GENERATOR -- Produces a structured FDD ready for review and sign-off.
Sections generated: Purpose, Business Context, Data Fields (with resolved labels), Business Rules, Related Objects, Security, and Open Questions.
Triggers: 'write FDD for', 'generate FDD', 'functional spec for', 'document this process', 'write functional design', 'rédiger le cahier des charges', 'CdC pour', 'fiche de conception'.
batch_search
WHEN: you need context on multiple D365 objects or concepts simultaneously -- runs all queries in parallel. Use INSTEAD of multiple sequential search_d365_code calls -- each line becomes one parallel search. Maximum 6 queries per call. Results are equivalent to search_d365_code but returned together. When batch_search returns results, all matching objects are FULLY loaded (all chunks). Do NOT follow up with get_object_details on the same objects -- the complete source is already included.
Triggers: 'find all of these', 'look up multiple', 'cherche plusieurs', 'SalesTable AND VendTable', 'several objects at once', 'lookup X and Y and Z', 'plusieurs objets en même temps', 'context on all of these'.
map_business_process
WHEN: mapping the technical D365 objects behind a business process, or understanding which tables/forms implement a flow. Triggers: 'processus métier', 'Order-to-Cash', 'Procure-to-Pay', 'Record-to-Report', 'business process flow', 'qui est impliqué dans', 'map the process', 'flux du processus', 'quels objets dans le flux'. Map a D365 F&O business process to its complete object chain. For known processes (Order-to-Cash, Procure-to-Pay, Record-to-Report, Plan-to-Produce, Inventory-Management, Hire-to-Retire, Project-Accounting, Asset-Lifecycle): shows every step with forms, tables, classes, entities, reports, and security roles involved. For any other object name: traces all dependencies (tables, classes, forms, entities) from that entry point. Produces a Mermaid process flow diagram. Use 'list' to see all known process mappings. NOT for a single object's FK relations only -- use `find_related_objects` for that (faster and more precise).
list_objects
WHEN: you need ALL objects of a given type or in a given model. Triggers: 'list all tables in ALM', 'show all classes', 'quels objets dans le modèle', 'give me all forms'. Full index scan -- returns EVERY matching object, not just top search results. Use to discover what tables, classes, forms, enums, etc. exist in a specific model. When no filters are given and a custom model is configured, defaults to listing that model. NOT for a single object -- use get_object_details. NOT for natural language search -- use search_d365_code.
find_entity_for_table
WHEN: developer needs to integrate via OData and wants to find the entity name for a given table. Also generates a new entity template when none exists and generateIfMissing=true. Triggers: 'which entity exposes', 'OData entity for', 'find entity for', 'quelle entité expose', 'DMF entity for', 'create data entity', 'expose via OData', 'generate entity', 'entité de données'. Find D365 F&O data entities that expose a given table for OData/DMF integrations. Answers: 'Which entity exposes SalesTable for OData?' Scans all indexed AxDataEntityView objects to find entities with matching data sources. Returns entity name, public entity name (for OData URL), IsPublic status, key fields, and all data sources. Essential for integration development. Set generateIfMissing=true to auto-generate an AxDataEntityView XML template when no public entity is found.
search_labels
Search D365 F&O labels across all indexed languages. Given text (e.g. 'Sales order'), finds the matching label ID (@SYS12345). Given a label ID (e.g. '@SYS12345' or '@SYS:12345'), finds the text in all languages. Accepts both D365 short form (@SYS124480) and colon form (@SYS:124480) -- both are normalized automatically. Searches across 1 000 000+ label entries. WORKFLOW: call search_labels first to resolve the label text, then call find_references with the same label ID to find ALL X++ objects (forms, tables, classes, reports) that use it in their code or metadata. Languages: en-US and fr are loaded at startup. Other languages (de, nl, ar, es, zh...) are loaded on-demand -- first call ~15s, then instant.
ado_estimate_effort
WHEN: user asks for an effort estimate, chiffrage, or development hours for a D365 Work Item. [~] PRIORITY TRIGGER: call AFTER `ado_analyze_workitem` when the user asks 'how long?', 'estimate this', 'chiffre ce WI'.
[t] EFFORT ESTIMATOR -- Estimate D365 F&O development effort for a Work Item. Uses KB signals (object count, method complexity, existing extensions, relation depth) combined with ADO history (similar past tasks) to produce a structured hour estimate broken down by phase: Analysis / Dev / Test / Deploy.
Returns:
* Per-phase hour breakdown (table)
* KB signals used (objects found, extensions, complexity flags)
* Confidence level and risk factors
* Ready-to-paste estimate for ADO task Original Estimate field
Triggers: 'estimate WI #N', 'how long for WI #N', 'chiffrage WI #N', 'effort estimate', 'combien de jours pour', 'combien d\'heures pour'.
find_related_objects
WHEN: you need ALL relations, schema, or foreign keys of a D365 object. Triggers: 'what tables are linked to', 'quelles tables sont liées à', 'relations de', 'qui référence', 'foreign keys of', 'before generating code for', 'show me the schema', 'what joins to', 'table structure', 'liens entre tables', 'structure de la table', 'all FK of', 'dépendances de', 'linked tables', 'related tables'. Returns outgoing FK/DeleteAction/DataSource relations AND incoming back-references. ALWAYS call this BEFORE generating any code that touches multiple objects. Note: when the relation index is loaded this delegates to get_relation_graph internally -- do NOT call both find_related_objects AND get_relation_graph for the same object; the results are identical.
trace_role_license_tree
WHEN: security design, licence audit, or 'what licence does this role require?'. Triggers: 'arborescence du rôle', 'licence nécessaire pour', 'what licence for role', 'role tree', 'droits du rôle', 'entry points of role', 'privilege tree for'. Builds the COMPLETE tree for ONE role: Role -> Duties -> Privileges -> Entry Points. For each entry point, classifies the required D365 licence per the March 2026 Licensing Guide: Team Members (~$8/user/mo, read-only + named tasks), Operations-Activity (~$50, warehouse mobile & production floor), Finance (~$180), Supply Chain Mgmt (~$180), Human Resources (~$22), Project Operations (~$120), Commerce (~$180). Grant-level aware: NoAccess/Read/View -> Team Members; Activity writes -> Operations-Activity; transactional writes -> full product licence based on functional area. Confidence: High (known module prefix) . Medium (keyword) . Low (fallback). Ends with a Optimization section: Team Members / Activity eligibility, role-split opportunities, per-user/month cost estimates (March 2026 MSRP). Always validate against the [Microsoft D365 Licensing Guide](https://go.microsoft.com/fwlink/?LinkId=866544). For a full multi-role scan, call `trace_role_license_tree` multiple times -- once per role. NOT for the pure technical duty/privilege/entry-point chain without licence inference -- use `trace_security_chain` for that.
find_callers
Find who calls a D365 F&O method/class AND get the full cross-reference profile from the compiled XRef DB. Covers ALL reference kinds: Call graph (who calls this method, what does it call), Usage (who references this type), Inheritance (base class chain, sub-classes), Interface (what interfaces implemented, what classes implement an interface), Overrides (which method is overridden, which sub-classes override it), Attributes (which decorators are applied). Requires xref_index.json.gz generated from DYNAMICSXREFDB by GenerateCache --xref-conn. Triggers: 'qui appelle', 'who calls', 'call chain', 'callers of', 'où est appelé', 'qui hérite', 'qui implémente', 'qui override', 'quels attributs'.
suggest_edt
WHEN: adding a new field to a table -- find the best existing D365 EDT to extend instead of using raw primitives (str, int64, real, date). Triggers: 'what EDT for', 'which EDT should I extend', 'quel EDT pour', 'quel type étendu', 'EDT for a field'. D365 best practice mandates EDT reuse over raw primitive types. Call BEFORE declaring any field with a primitive type. Returns ranked candidate EDTs with their base type, label, and model.
trace_security_chain
WHEN: security audit -- need the TECHNICAL chain from Role/Duty/Privilege to Entry Points and Table/Form permissions. Also handles BUSINESS-LANGUAGE role explanation when businessLanguage=true. Triggers (technical): 'sécurité de', 'who can access', 'security for', 'role duty privilege', 'droits sur', 'technical security chain', 'trace le rôle', 'what privileges does', 'what duties are assigned', 'which role allows', 'accès au formulaire', 'what roles have access', 'quel rôle donne accès'. Triggers (business language): 'what can a user with role X do', 'explain this role', 'what does this role give access to', 'quel accès donne ce rôle', 'droits du rôle', 'what licence does this role need', 'droits requis pour'. Traverses: Role -> Duties -> Privileges -> Entry Points -> Table/Form Permissions. Set businessLanguage=true for plain-language capability list (no Duty/Privilege IDs). NOT for licence cost inference per entry point -- use trace_role_license_tree for that.
ado_gap_fit_analysis
WHEN: user asks whether a D365 requirement is standard, needs config, needs an extension, or is a full gap. Also triggered by gap analysis or fit/gap classification of a Work Item.
GAP / FIT CLASSIFIER -- Analyse a D365 F&O requirement (from an ADO Work Item OR plain text) and classify it as one of four verdicts:
[OK] Standard Fit -- D365 covers this out-of-the-box, no dev needed
[gear] Config Fit -- D365 has it but requires parameter / profile setup
Extension Fit -- Standard process exists; a CoC/event-handler is enough
[X] Gap -- No standard coverage; custom development required
For each requirement block the tool returns:
-- Detected D365 domain (Settlement, PaymentJournal, DataImport, ...)
-- Standard objects found in KB and their process step
-- Existing extensions in the custom model (if D365_CUSTOM_MODEL_PATH is set)
-- Effort estimate (hours) and a one-paragraph reasoning
Triggers: 'analyse the requirement', 'is this a gap or fit', 'gap analysis WI #N', 'standard or custom for WI #N', 'does D365 cover this'. [~] When a WI has already been analysed by `ado_analyze_workitem` in the same turn, pass the requirement text directly via `requirementText` -- do NOT re-fetch with `workItemId`.
ado_post_pr_comment
WHEN: user explicitly asks to post, add, or save a review comment to an ADO Pull Request. [~] PRIORITY TRIGGER: call AFTER `ado_analyze_pr_impact` when user says 'post the review', 'add comment to PR', 'ajoute le commentaire sur la PR'.
WARNING: ALWAYS ask for explicit user confirmation before calling this tool. Recommended workflow: (1) call `ado_analyze_pr_impact`, (2) show the result, (3) ask 'Shall I post this review comment to PR #X?', (4) only then call this tool. Requires DEVOPS_ORG_URL + DEVOPS_PAT (Pull Request Threads: Read & Write).
list_custom_model_objects
WHEN: developer wants to see what custom/extension objects exist in their model. Triggers: 'list my custom objects', 'what have we customized', 'show ISV objects', 'list custom model', 'what objects are in our model'. List all D365 F&O objects in the custom/extension model directory on disk. Reads the file system directly -- always reflects the latest uncommitted state. Pass `customModelPath` to specify a model directory; or set it once via the `D365-Custom-Model-Path` header in your .mcp.json (applies to all tool calls automatically).
ado_analyze_workitem
AZURE DEVOPS ONLY -- Fetch a Work Item and assemble ALL technical context needed for D365 F&O expert analysis. [~] PRIORITY TRIGGER: 'analyse le workitem', 'analyse la tâche', 'analyse le FDD/RDD/CR/IDD', 'read the work item', 'check the bug', 'look at ticket', 'review task', '#1234', 'WI#', 'WI ', 'item #'. NEVER for: labels (@SYS/@TRX/@FIN), X++ code lookup, AOT objects -- use search_labels / search_d365_code instead.
## WHAT THIS TOOL RETURNS
Raw structured context only -- NOT a finished analysis. The tool returns:
1. Work item metadata (title, description, repro steps, acceptance criteria, comments)
2. D365 standard KB object details: fields, methods, code snippets for every matched object
3. Custom code on disk (Aprolis extension): existing CoC methods, extension bodies
4. Chain of Command / relation graph for all impacted objects
## YOUR JOB AS COPILOT AFTER CALLING THIS TOOL
You MUST synthesize the raw context into a precise developer-ready analysis IN FRENCH.
Write it in a professional tone, as if authored by a senior D365 consultant -- no emojis, no icons.
The analysis must contain these sections:
1. **Compréhension du besoin** -- résume ce que le client demande en 2-3 phrases claires
2. **Analyse technique** -- identifie la cause racine en croisant le besoin + les objets KB + le code custom
3. **Instructions de développement** -- liste ordonnée et précise : quel objet, quelle méthode, quoi modifier
- Si une extension custom existe sur disque -> pointer exactement quelle méthode à modifier
- Si pas d'extension -> indiquer quel CoC créer, sur quel objet standard, quelle méthode
4. **Estimation** -- chiffrage en heures/jours selon la complexité détectée
5. **Commentaire ADO** -- Texte markdown sans icônes, prêt à poster sur le WI analysé UNIQUEMENT.
IMPORTANT: never post (never call ado_post_comment) on any linked/related work item -- only on the analyzed WI.
Requires DEVOPS_ORG_URL + DEVOPS_PAT env vars.
suggest_refactoring
WHEN: developer wants to improve code quality before a PR merge or code review. Triggers: 'refactor', 'clean up', 'simplify', 'too long method', 'nested ifs', 'code smells', 'améliorer le code'. Suggest concrete refactoring actions for YOUR custom D365 F&O X++ code. [!] Only runs on custom/extension code (D365_CUSTOM_MODEL_PATH). Refactoring standard Microsoft code is not actionable. Analyzes: long methods (extract method), deep nesting (guard clauses), row-by-row operations (set-based), large switch statements (strategy pattern), hardcoded strings (constants), unprotected CLR calls (error handling), wide transactions (narrow scope). Returns before/after code examples.
generate_query
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.
detect_performance_issues
WHEN: slow query, performance review, or N+1 query check on ANY D365 F&O object (custom or standard). Triggers: 'performance', 'lent', 'slow', 'optimise', 'N+1', 'requête dans une boucle', 'query in loop', 'perf issues', 'slow query', 'requête lente', 'optimise ce code', 'missing firstonly', 'set-based'. Detects: N+1 queries, queries in loops, missing field lists, row-by-row inserts/updates, missing firstonly. NEVER call for a general code quality or best-practice audit -- use validate_best_practices for that. Only call when the user explicitly mentions performance, slow queries, N+1, row-by-row inserts, or set-based operations. [!] Auto-fixing is only possible on YOUR custom code (D365_CUSTOM_MODEL_PATH). Standard D365 objects return issues as read-only analysis.
generate_xpp_template
WHEN: writing an extension or customization -- generates ready-to-use X++ code. Triggers: 'génère un CoC', 'crée une extension', 'generate extension', 'write a CoC class', 'event handler pour', 'template pour'. Uses REAL metadata from the KB (actual field names, method signatures). 'coc' = Chain of Command class, 'table_extension' = extend table with fields/methods, 'event_handler' = pre/post event handler, 'job' = runnable class, 'find_method' = find/exist pattern. ALWAYS call get_object_details first to verify the object exists.
find_references
WHEN: impact analysis -- 'what breaks if I change X?', 'where is this used?', 'all usages of'. Triggers: 'qui utilise', 'impact de la modification', 'what uses', 'where is X referenced', 'before deleting', 'où est utilisé', 'impact of changing', 'all usages of', 'qui appelle ce champ', 'find all references to', 'tout ce qui utilise'. Full index scan (O(1M+ chunks)) -- EXPENSIVE. Only call when the user explicitly asks for usages/references/impact. When the XRef index is loaded, PREFER find_callers -- it is O(1) vs O(1M+) here and covers call chains, inheritance, and interface implementations. Use find_references only when find_callers is unavailable or for label IDs and field-level text scan. NEVER call just to identify or describe an object -- use get_object_details or search_d365_code for that. NEVER call for 'what is X', 'what does X do', 'explain X', 'show me X', 'what enum is X'. For label IDs (e.g. '@SYS124480' or '@SYS:124480'): automatically searches BOTH forms simultaneously -- the short form appears in X++ code, the colon form appears in metadata (Label: property). WORKFLOW for labels: (1) search_labels to get the label text, (2) find_references with the label ID to find all usages in forms/tables/classes/reports. NOT for extensions only -- use find_extensions for CoC/event handlers specifically.
explain_workflow
WHEN: user asks how an approval workflow works, who approves a document, what states it goes through, or what happens on submission/rejection. NOT for technical workflow class details -- use `get_object_details`.
WORKFLOW EXPLAINER (Business Language) -- Explains a D365 approval workflow: who approves, what states exist, and what happens on approval or rejection. Output is plain business language -- no X++ or workflow engine jargon.
Triggers: 'explain the workflow for', 'how does the approval work', 'qui approuve', 'workflow states for', 'étapes du workflow', 'approval process for', 'circuit d\'approbation', 'what happens when a user submits'.
search_d365_code
WHEN: object name is unknown, partial, or you need to find by concept/keyword. Triggers: 'find', 'search', 'look for', 'chercher', 'trouver', 'où est', 'comment fonctionne', 'what is', 'show me'. Search the D365 F&O knowledge base for X++ code, tables, classes, forms, views, enums, EDTs, security objects using natural language or partial names. Returns ALL chunks (metadata, Declaration, methods) for the top-scoring objects so the LLM has complete context on the first call. Lower-scoring results return a short preview. No follow-up get_object_details call is needed for top results. NOT for listing all objects in a model -- use list_objects for that. NOT when the exact name is known -- use get_object_details for that. NEVER call search_d365_code twice in the same conversation turn. If one search did not find the object, answer from what you have -- do not repeat the search. When you need context on MORE THAN ONE concept simultaneously, use batch_search instead -- it runs all queries in parallel and is faster. NEVER use this tool when the user mentions: 'FDD', 'RDD', 'IDD', 'Task', 'Workitem', 'Work Item', 'Bug', 'PR', 'Pull Request', 'ticket', 'DevOps', 'sprint', 'backlog', '#1234', 'WI#', 'analyse le workitem', 'analyse la tâche', 'analyse le FDD'. For those, always use ado_query_workitems, ado_analyze_workitem, ado_list_prs, or ado_analyze_pr_impact instead.
generate_unit_test
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.