Skip to main content
Glama
business-central-mcp

business-central-mcp

by SShadowS

bc_close_page

Idempotent

Close an open Business Central page using its pageContextId to free the server-side WebSocket session and prevent resource leaks once you are done with it.

Instructions

Closes an open Business Central page and frees its server-side resources including the WebSocket form session. Always call this when you are finished working with a page to prevent resource leaks on the BC server. Requires a pageContextId from bc_open_page.

After closing, the pageContextId becomes invalid -- any subsequent bc_read_data, bc_write_data, bc_execute_action, or bc_navigate calls using it will fail. It is safe to call this even if prior operations on the page encountered errors. If you opened a drill-down page via bc_navigate (which returns a new pageContextId), close both the drill-down page and the original list page when done.

Do NOT call this on a dialog's pageContextId (from dialogsOpened): answer the dialog with bc_respond_dialog instead, e.g. "cancel" to dismiss it. Closing a modal can accept it, so this tool refuses.

Do NOT call this in the middle of a multi-step workflow -- finish all reads, writes, and actions on the page first. Do NOT call this to "reset" a page; use bc_read_data to refresh data instead.

Input Schema

NameRequiredDescriptionDefault
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.
pageContextIdYesPage context ID returned by bc_open_page. Becomes invalid after closing.

Output Schema

NameRequiredDescriptionDefault
successYes
replaySafeYes
dialogsOpenedYes
requiresDialogResponseYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.4.7
    • addedOutput schema / properties / dialogsOpened / items / properties / pageContextId
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / properties / dialogsOpened / items / required
      Previous value: -[
      -  "formId"
      -]New value: +[
      +  "formId",
      +  "pageContextId"
      +]
  2. 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"
      +    },
      +    "replaySafe": {
      +      "type": "boolean"
      +    },
      +    "requiresDialogResponse": {
      +      "type": "boolean"
      +    },
      +    "success": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "success",
      +    "dialogsOpened",
      +    "requiresDialogResponse",
      +    "replaySafe"
      +  ],
      +  "type": "object"
      +}
  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 annotations: it discloses that pageContextId is invalidated, that subsequent read/write/action/navigate calls on it will fail, that calling after errors is safe, that closing a modal could accept it so the tool refuses, and the drill-down two-page cleanup rule. Annotations already cover safety/idempotency, but this adds genuine lifecycle and side-effect context.

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, with the primary guidance first and exclusions grouped after. It is somewhat long, with mild redundancy between "frees its server-side resources" and the resource-leak warning, but nearly every sentence contributes an operative rule.

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?

Given an output schema, full annotation set, and 100% schema coverage, the description fills the remaining behavioral gap: invalidation, workflow timing, dialog handling, and drill-down cleanup. Nothing an agent needs to call this correctly 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?

Schema coverage is 100% and the schema itself documents operationId and pageContextId thoroughly. The description adds meaning the schema does not: that pageContextId must come from bc_open_page and becomes invalid after closing. Modest but real value above the schema baseline.

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 ("Closes an open Business Central page and frees its server-side resources including the WebSocket form session"), and the effect on the session distinguishes it from siblings like bc_navigate and bc_open_page. An agent can identify this as the lifecycle-termination tool without opening the 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?

Gives explicit when-to-use ("Always call this when you are finished working with a page"), explicit when-not-to (not mid-workflow, not to reset a page, not on dialog contexts), and names the alternatives: bc_respond_dialog for dialogs, bc_read_data to refresh. This is the strongest dimension of the definition.

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