Skip to main content
Glama
business-central-mcp

business-central-mcp

by SShadowS

bc_switch_company

Idempotent

Switch the active Business Central session to a specified company; existing page contexts become invalid, so re-open needed pages before continuing work.

Instructions

Switch to a different company within the current Business Central session. All currently open pages will be invalidated and their pageContextIds will become unusable -- you must call bc_open_page to re-open any pages you need in the new company context.

Use bc_list_companies first to see the available company names and verify the target company exists. The companyName must be an exact, case-sensitive match (a wrong-case or unknown name returns COMPANY_NOT_FOUND and leaves the session on its current company). After switching, all subsequent bc_open_page, bc_read_data, bc_write_data, and bc_execute_action calls will operate against the new company's data.

Do NOT switch companies in the middle of a multi-step workflow (e.g., between creating a Sales Order and posting it). Complete all operations in the current company first, then switch.

Example: { "companyName": "CRONUS International Ltd." }

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "companyName": "<companyName>"
    },
    "name": "bc_switch_company"
  }
}

Input Schema

NameRequiredDescriptionDefault
companyNameYesExact company name to switch to. Use bc_list_companies to see available company names.
operationIdNoOptional idempotency key (e.g. a UUID you generate): a retry with the same key and arguments returns the stored result instead of re-running. See the server instructions.

Output Schema

NameRequiredDescriptionDefault
newCompanyYes
replaySafeYes
previousCompanyYes
invalidatedPageContextIdsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.0.0
    • changedInput schema / properties / operationId / description
      Previous value: -"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."New value: +"Optional idempotency key (e.g. a UUID you generate): a retry with the same key and arguments returns the stored result instead of re-running. See the server instructions."
  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": {
      +    "invalidatedPageContextIds": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "newCompany": {
      +      "type": "string"
      +    },
      +    "previousCompany": {
      +      "type": "string"
      +    },
      +    "replaySafe": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "previousCompany",
      +    "newCompany",
      +    "invalidatedPageContextIds",
      +    "replaySafe"
      +  ],
      +  "type": "object"
      +}
  3. First observedv1.5.0

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, idempotentHint=true, and destructiveHint=false, so the bar is lower. The description nevertheless adds genuinely useful behavior beyond them: open pages are invalidated, pageContextIds become unusable and must be re-opened via bc_open_page, a bad name returns COMPANY_NOT_FOUND and leaves the session on its current company, and subsequent bc_open_page/bc_read_data/bc_write_data/bc_execute_action calls target the new company. That is strong context, though the session-state side effects are not framed as irreversible beyond page invalidation.

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 the core action and its immediate consequence, then prerequisites, then the workflow caveat, then an example. Every sentence carries distinct information, though the closing example is somewhat redundant given the single required string parameter.

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?

Output schema exists so return values need no explanation, and the description still covers the state transitions, error mode, prerequisites, and sequencing constraints an agent needs before invoking a session-level switch. 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?

Schema coverage is 100%, so companyName and operationId are already documented, giving a baseline of 3. The description adds real meaning on top: case sensitivity, the exact failure mode (COMPANY_NOT_FOUND), and a concrete example payload showing the format, which the schema does not convey.

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 (switch) and resource (company) scoped to the current Business Central session, and implicitly distinguishes itself from bc_list_companies, which it names as the discovery tool rather than the switching tool. An agent can tell exactly what this does and what mutates.

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?

Explicitly says to call bc_list_companies first to verify the target exists, states the exact case-sensitive match requirement, and gives a clear when-not: do not switch in the middle of a multi-step workflow such as creating then posting a Sales Order. Alternatives and prerequisites are both covered.

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