bc_data_get_table_schema
Returns a Business Central table's field names, types, option values, FlowField formulas, and relations so you can write correct AL queries without name errors.
Instructions
Returns the fields of a Business Central table as compact pipe-delimited text: a header with the table name, ID and primary key, then one line per field with its exact name and type, option values for Option fields, the formula for FlowFields (e.g. "FlowField: Sum("Cust. Ledger Entry"."Amount")"), and TableRelation targets ("rel: Country/Region"). Field names differ between environments and installed extensions, so call this for EVERY table before writing an AL query for bc_data_query — a wrong name is a compile error (AL0345).
Use fieldClass to list only Normal fields, FlowFields or FlowFilters, and nameContains to keep the answer small on wide tables (e.g. ["No.", "Amount", "Date"]). Get table IDs from bc_data_find_tables. When NOT to use: to read field values (this returns metadata only; run a query with bc_data_query, or read a page with bc_open_page). Runs on BC's own MCP server (BC 29+, "Data Query Tools (Preview)" enabled); needs no web-client session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company | No | Company to run in (exact, case-sensitive name from bc_list_companies). Defaults to the current session company, then BC_ODATA_COMPANY, then the user's default company in BC. | |
| tableId | Yes | Numeric BC table ID (e.g., 18 Customer, 17 G/L Entry, 37 Sales Line). Find IDs with bc_data_find_tables. | |
| fieldClass | No | Only fields of this class. FlowFields are calculated (e.g., Customer "Balance (LCY)"); FlowFilters only narrow FlowField calculations. | |
| nameContains | No | Only fields whose name contains any of these fragments (case-insensitive), e.g. ["No.", "Amount"]. Use it on wide tables to keep the answer small. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | ||
| company | Yes | ||
| tableId | Yes |