Skip to main content
Glama
business-central-mcp

business-central-mcp

by SShadowS

bc_query

Read-only

Queries Business Central records in bulk using server-side OData filtering, sorting, and field projection, so you can retrieve many structured records without UI navigation.

Instructions

Reads records from Business Central in bulk using the Standard API v2.0 (OData/REST on port 7048). Use bc_query for efficient server-side filtered, sorted, and projected reads over many records — for example, fetching all open sales orders, listing customers in a city, or pulling G/L entries for a date range. This is far more efficient than using bc_open_page + bc_read_data for bulk reads because filtering and projection happen on the server before any data is transferred.

When to use bc_query: structured data retrieval over standard BC entities, when you need 2+ records with specific field selection, when you want server-side filter/sort/OData operators ($filter, $select, $top, $orderby, $expand), or when you need to inspect a large dataset without driving the BC UI. Entity names are BC Standard API v2.0 names (camelCase): customers, vendors, items, salesOrders, salesInvoices, purchaseOrders, purchaseInvoices, generalLedgerEntries, accounts, journals, journalLines, companies, employees, dimensions, dimensionValues, currencies, paymentTerms, shipmentMethods, paymentMethods, countriesRegions, unitsOfMeasure, taxGroups, contacts. Pass filter as OData $filter syntax (e.g., "city eq 'London'", "amount gt 1000", "postingDate ge 2024-01-01"). Pass select as comma-separated field names (e.g., "number,displayName,city") to limit response size. top defaults to 100 if omitted — pass explicitly to get more or fewer rows. Queries are company-scoped automatically; pass company to target a specific company (see bc_list_companies). The special "companies" entity is the one exception — it is the top-level environment list (not company-scoped), so the company parameter is ignored for it; query it to discover available companies.

When NOT to use bc_query: do not use for UI-driven flows (navigating pages, clicking buttons, filling forms — use bc_open_page + bc_execute_action for those). Do not use bc_query for posting, writing, or triggering BC business logic — OData reads are read-only; use bc_write_data and bc_execute_action for mutations. Do not use for custom/extension entities not in the Standard API v2.0 — those require the UI WebSocket tools. Auth: on-prem NavUserPassword uses HTTP Basic; BC Online (SaaS) uses device-code — when sign-in is needed the tool returns DEVICE_LOGIN_REQUIRED with a verification URL and code to show the user, and a retry after they sign in runs the query. bc_query does not need a /csh WebSocket session and does not open the SaaS sign-in window.

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": {
      "entity": "<entity>"
    },
    "name": "bc_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
topNoMaximum number of rows to return. Defaults to 100 if omitted to prevent accidental full-table scans. Pass explicitly to get more rows.
skipNoRows to skip ($skip), for paging: when hasMore is true, call again with skip increased by rowCount (keep the same orderby).
entityYesBC Standard API v2.0 entity name (camelCase). Examples: customers, vendors, items, salesOrders, salesInvoices, purchaseOrders, generalLedgerEntries, accounts, companies, employees. See BC Standard API docs for the full list.
expandNoOData $expand for related entities. Examples: "salesLines", "customer($select=displayName)". Use sparingly — expanded entities increase response size significantly.
filterNoOData $filter expression for server-side filtering. Examples: "city eq 'London'", "amount gt 1000", "postingDate ge 2024-01-01 and postingDate le 2024-12-31", "contains(displayName, 'Contoso')". Applied by BC before returning data.
selectNoComma-separated OData $select field names to limit response size. Examples: "number,displayName,city", "id,amount,postingDate". Omit to return all fields.
companyNoOverride the BC company name for this query. Defaults to the server-configured company (BC_ODATA_COMPANY or first available company). Use when querying a specific company in a multi-company BC environment.
orderbyNoOData $orderby expression. Examples: "displayName asc", "postingDate desc", "amount desc,number asc".

Output Schema

NameRequiredDescriptionDefault
rowsYes
countNo
entityYes
hasMoreYes
cappedAtNo
rowCountYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.0.0
    • addedInput schema / properties / skip
      Added value: +{
      +  "description": "Rows to skip ($skip), for paging: when hasMore is true, call again with skip increased by rowCount (keep the same orderby).",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
  2. Changed1 schema field changedv2.0.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "cappedAt": {
      +      "type": "number"
      +    },
      +    "count": {
      +      "type": "number"
      +    },
      +    "entity": {
      +      "type": "string"
      +    },
      +    "hasMore": {
      +      "type": "boolean"
      +    },
      +    "rowCount": {
      +      "type": "number"
      +    },
      +    "rows": {
      +      "items": {},
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "entity",
      +    "rows",
      +    "rowCount",
      +    "hasMore"
      +  ],
      +  "type": "object"
      +}
  3. First observedv1.5.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations only say readOnlyHint=true and openWorldHint=false, but the description adds materially: auth mode per deployment (Basic vs device-code), the DEVICE_LOGIN_REQUIRED return token with verification URL/code and retry semantics, automatic company scoping, and the fact that no /csh WebSocket session is opened. It stops short of describing result shape or rate/limits, but that is largely annotation-supplemented territory.

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, then cleanly sectioned into when-to-use / when-not-to-use / auth, so an agent can stop reading early. It is long and slightly repetitive (the efficiency contrast against bc_open_page + bc_read_data is stated twice), but nearly every sentence carries operational information.

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?

Covers all 8 parameters, the pagination pattern (skip/hasMore/rowCount is documented in the schema), multi-company scoping, entity-name constraints, and auth edge cases; return values need not be described because an output schema exists. Nothing an agent needs to invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% so the baseline is 3, and the description still adds real meaning: an enumerated list of valid entity names, OData operator guidance ($filter/$select/$top/$orderby/$expand), the top=100 default rationale, and the non-obvious exception that the "companies" entity ignores the company parameter. That exception is behaviorally essential and is not derivable from the schema alone.

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?

Opens with a specific verb + resource + transport ("Reads records from Business Central in bulk using the Standard API v2.0 (OData/REST on port 7048)") and explicitly contrasts itself with bc_read_data/bc_open_page for bulk reads. An agent can distinguish it from siblings without opening any 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?

Has dedicated "When to use" and "When NOT to use" blocks naming alternatives: bc_open_page + bc_execute_action for UI flows, bc_write_data/bc_execute_action for mutations, UI WebSocket tools for custom entities, and bc_list_companies for company discovery. Exclusions are as explicit as the inclusions.

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