Skip to main content
Glama
SShadowS

business-central-mcp

by SShadowS

bc_run_report

Destructive

Execute Business Central reports server-side by report ID to batch post, adjust inventory, or capture rendered PDF, Excel, or Word output.

Instructions

Execute a Business Central report by its numeric report ID. If the report has a request page (parameter/filter dialog), the response's requestPage carries its fields plus a requestPage.pageContextId and requestPage.formId. Fill parameters with bc_write_data against that pageContextId, then run the report with bc_respond_dialog { dialogFormId: requestPage.formId, response: "ok" }. The report runs server-side on the BC service tier.

Pass format: "pdf", "excel", or "word" to capture the rendered output as base64-encoded bytes (this path auto-drives the request page, so no bc_write_data/bc_respond_dialog is needed). The tool drives the BC "Send to..." flow (SystemAction 410) internally: opens the format-selection dialog, selects the requested format by SaveValue-ing the matching text label into the SelectionControl, confirms with OK (300), then fetches the file from DynamicFileHandler.axd. When format is set, rendered file bytes are returned in downloads[] (base64 in bytes, or savedPath when BC_DOWNLOAD_DIR is set); an oversized file reports a per-entry error instead of bytes, and an operationId replay reports NOT_REPLAYED (the ledger keeps no bytes).

Format availability depends on the report's installed layouts -- not all reports offer all three formats. If the report does not offer the requested format, an error is returned listing the available option texts. "pdf" is always BC's default and requires no SaveValue; "excel" prefers the "data only" variant; "word" targets any option containing "Word".

Use this tool for reports that perform server-side actions (batch posting via Report 295, inventory adjustments, data processing) or to inspect and fill request page parameters. Common reports: 1306 (Customer Statement), 120 (Aged Accounts Receivable), 6 (Trial Balance), 295 (Batch Post Sales Orders).

Do NOT use this for viewing data -- use bc_open_page and bc_read_data for data retrieval. Do NOT confuse reports with pages -- reports are processing/printing objects, pages are UI views.

Example (open request page): { "reportId": 6 } Example (capture PDF): { "reportId": 6, "format": "pdf" } Example (capture Excel): { "reportId": 6, "format": "excel" } Example (capture Word): { "reportId": 6, "format": "word" }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoRendered output format to capture via the BC "Send to..." flow. "pdf" captures a PDF (BC default); "excel" captures Excel (prefers "data only" layout); "word" captures a Word document. Format availability depends on the report's installed layouts -- reports without the requested layout return an error listing available formats. Omit to open the request page only without executing.
reportIdYesNumeric BC report ID to execute (e.g., 1306 for Customer Statement, 6 for Trial Balance).
operationIdNoOptional idempotency key (e.g. a UUID you generate). Retrying with the same operationId and the same arguments returns the first call's stored result instead of running the change again, so a retry after a dropped connection or timeout cannot double-post. Reusing it with different arguments is rejected (OPERATION_ID_REUSED). If the first call's outcome is unknown, the retry returns OPERATION_IN_DOUBT: check the record's state before acting again under a new operationId. Every result of this tool carries replaySafe: true means BC's response proved that re-running the same call (even under a new operationId, after an unknown outcome) cannot apply the change twice -- the write was echoed as an absolute value, or the form it acted on is closed so BC rejects a re-run; false means a re-run may double-apply or nothing proved otherwise, so read the record back before retrying. Replay is time-limited: a completed entry is kept for BC_OPERATION_TTL (default 24h), after which the same operationId runs the call again; check with bc_get_operation before a late retry. A replayed result carries download metadata (fileName, contentType, sizeBytes, savedPath) but not the file bytes.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYes
reportIdYes
downloadsYes
replaySafeYes
requestPageNo
externalUrisYes
dialogsOpenedYes
requiresDialogResponseYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.0.0
    • addedInput schema / properties / operationId
      Added value: +{
      +  "description": "Optional idempotency key (e.g. a UUID you generate). Retrying with the same operationId and the same arguments returns the first call's stored result instead of running the change again, so a retry after a dropped connection or timeout cannot double-post. Reusing it with different arguments is rejected (OPERATION_ID_REUSED). If the first call's outcome is unknown, the retry returns OPERATION_IN_DOUBT: check the record's state before acting again under a new operationId. Every result of this tool carries replaySafe: true means BC's response proved that re-running the same call (even under a new operationId, after an unknown outcome) cannot apply the change twice -- the write was echoed as an absolute value, or the form it acted on is closed so BC rejects a re-run; false means a re-run may double-apply or nothing proved otherwise, so read the record back before retrying. Replay is time-limited: a completed entry is kept for BC_OPERATION_TTL (default 24h), after which the same operationId runs the call again; check with bc_get_operation before a late retry. A replayed result carries download metadata (fileName, contentType, sizeBytes, savedPath) but not the file bytes.",
      +  "maxLength": 200,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "dialogsOpened": {
      +      "items": {
      +        "additionalProperties": {},
      +        "properties": {
      +          "formId": {
      +            "type": "string"
      +          },
      +          "message": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "formId"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "downloads": {
      +      "items": {
      +        "additionalProperties": {},
      +        "properties": {
      +          "contentType": {
      +            "type": "string"
      +          },
      +          "fileName": {
      +            "type": "string"
      +          },
      +          "savedPath": {
      +            "type": "string"
      +          },
      +          "sizeBytes": {
      +            "type": "number"
      +          },
      +          "style": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "fileName",
      +          "contentType",
      +          "sizeBytes",
      +          "style"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "externalUris": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "style": {
      +            "type": "string"
      +          },
      +          "uri": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "uri",
      +          "style"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "replaySafe": {
      +      "type": "boolean"
      +    },
      +    "reportId": {
      +      "type": "number"
      +    },
      +    "requestPage": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "formId": {
      +          "type": "string"
      +        },
      +        "pageContextId": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "pageContextId",
      +        "formId"
      +      ],
      +      "type": "object"
      +    },
      +    "requiresDialogResponse": {
      +      "type": "boolean"
      +    },
      +    "success": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "success",
      +    "reportId",
      +    "dialogsOpened",
      +    "requiresDialogResponse",
      +    "downloads",
      +    "externalUris",
      +    "replaySafe"
      +  ],
      +  "type": "object"
      +}
  2. Changed2 schema fields changedv1.7.0
    • removedInput schema / properties / reportId / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  }
      -]
    • addedInput schema / properties / reportId / type
      Added value: +[
      +  "string",
      +  "number"
      +]
  3. First observedv1.5.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the destructiveHint/readOnlyHint annotations: it discloses the internal 'Send to...' SystemAction 410 flow, per-entry error on oversized files, NOT_REPLAYED on replayed downloads, format-availability errors listing option texts, and the requestPage/pageContextId mechanism. This is unusually rich behavioral disclosure for a mutating tool.

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?

Front-loaded with purpose, mode, then when-to-use, and closes with concrete examples. It is long and the format-selection mechanics and the four near-identical example lines partly duplicate the schema's format description, but nearly every sentence carries operational value.

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?

With an output schema present and annotations covering safety, the description supplies everything an agent additionally needs: request-page handling, format availability caveats, download/replay semantics, and sibling routing. Nothing material is missing.

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?

With 100% schema coverage the schema already documents all three params, so the baseline is 3; the description earns a bump by explaining the cross-tool workflow the requestPage fields feed into (bc_write_data against pageContextId, then bc_respond_dialog with formId) and clarifying that pdf is the default requiring no SaveValue.

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?

States a specific verb and resource ('Execute a Business Central report by its numeric report ID') and names concrete examples (1306, 120, 6, 295). It explicitly distinguishes reports from pages, so an agent can tell it apart from bc_open_page/bc_read_data without opening a schema.

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?

Explicit when-to-use ('reports that perform server-side actions... or to inspect and fill request page parameters') and when-not ('Do NOT use this for viewing data -- use bc_open_page and bc_read_data'). It also spells out the two operating modes and routes to the correct sibling tools (bc_write_data, bc_respond_dialog) for each.

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