pbirb-mcp

v0.4.1
io.github.mafaq229/pbirb-mcp Checked 6 hours ago Published 5 months ago

MCP server for editing Power BI Report Builder paginated reports (RDL)

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

describe_report

Top-level inventory of an RDL: data sources, datasets, parameters, tablixes, charts, and page setup. Always the first call when planning edits. v0.4: `tablixes` returns rich shape hints [{name, rows, columns, has_groups, has_subtotals, has_spans}] (was bare strings — migrate with `[t['name'] for t in tablixes]`). `charts` (new in v0.4) is a top-level array of chart names.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

get_datasets

Full DAX command text, fields, query parameters, and dataset-level filters for every DataSet in the report.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

get_parameters

Report parameter declarations: name, data type, prompt, flags.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

get_tablixes

Tablix layout with stable IDs: columns, row/column groups, sort expressions, filters, visibility. Required input for any tablix edit.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

update_dataset_query

Replace the DAX command text of a named dataset. The full DAX expression is accepted verbatim; empty bodies are rejected. Optional alias_strategy='preserve_field_names' positionally rewrites <DataField> cells to the new DAX columns while keeping existing <Field Name> identifiers — so Fields!X.Value references in expressions keep resolving.

ParameterTypeDescription
dataset_name *string
dax_body *stringFull DAX (e.g. EVALUATE TOPN(10, 'Sales')).
path *string
alias_strategystring | nullWhen 'preserve_field_names', positionally remap <DataField> cells to the new DAX column list.

add_query_parameter

Add a <QueryParameter> binding to a dataset's query. Use to wire report parameters into DAX (e.g. =Parameters!DateFrom.Value). PBIDATASET parameter naming rule: in DAX/<CommandText>, write @MyParam (with @). In <QueryParameter Name=...>, write MyParam (no @). SQL/MDX use @ in both places. This tool detects the dataset's provider and AUTO-STRIPS a leading @ from `name` for PBIDATASET datasets, returning {normalised: true, warning: ...}. Pass force_at_prefix=true to override (rare; needed for some RSCustomDaxFilter patterns).

ParameterTypeDescription
dataset_name *string
name *string
path *string
value_expression *string
force_at_prefixboolean

update_query_parameter

Change the value expression of an existing query parameter. Same PBIDATASET @-prefix normalisation as add_query_parameter applies on lookup; legacy Name='@X' parameters that already exist on disk are addressable via either @X or X.

ParameterTypeDescription
dataset_name *string
name *string
path *string
value_expression *string
force_at_prefixboolean

set_datasource_connection

Repoint a DataSource at a Power BI XMLA endpoint. workspace_url accepts a bare workspace name or a full powerbi:// URL; DataProvider is set to SQL (the AS provider id in RDL).

ParameterTypeDescription
dataset_name *stringPBI semantic model (Initial Catalog).
name *stringRDL DataSource Name attribute.
path *string
workspace_url *stringWorkspace name or full powerbi:// XMLA URL.
integrated_securitybooleanDefault true. False omits the element.

list_data_sources

Return a rich list of every <DataSource> in the report — name, data_provider, connect_string, integrated_security, shared_reference, security_type, data_source_id. describe_report.data_sources returns names only; this tool is the authoring-friendly read.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

get_data_source

Single-DataSource read-back (parity with get_textbox / get_image / get_rectangle / get_chart). Returns the same shape as one entry of list_data_sources.

ParameterTypeDescription
name *string
path *string

add_data_source

Create a new <DataSource> for a Power BI XMLA endpoint. workspace_url accepts a bare workspace name or a full powerbi:// URL. Generates a fresh rd:DataSourceID GUID. Refuses if a DataSource of the same name already exists. provider='sql' (default) emits the legacy DataProvider=SQL + powerbi:// ConnectString + <rd:SecurityType> shape; provider='pbidataset' emits the modern PBI Desktop shape — DataProvider=PBIDATASET, pbiazure:// ConnectString with ClaimsToken auth, plus <rd:PowerBIWorkspaceName> / <rd:PowerBIDatasetName> siblings, no <rd:SecurityType>.

ParameterTypeDescription
dataset_name *string
name *string
path *string
workspace_url *string
integrated_securityboolean
providerstring

remove_data_source

Remove a named <DataSource>. Refuses by default if any DataSet/Query/DataSourceName or DataSource/DataSourceReference still references it; the error lists the offending locators. Pass force=True to remove anyway.

ParameterTypeDescription
name *string
path *string
forceboolean

rename_data_source

Rename a <DataSource> and rewrite every reference: DataSet/Query/DataSourceName entries AND any DataSource/DataSourceReference shared-source links. Atomic: stages all matches before committing. Errors if new_name already exists or equals old_name.

ParameterTypeDescription
new_name *string
old_name *string
path *string

list_dataset_filters

List dataset-level filters in document order. Returns [{expression, operator, values}]; index in the list is the stable handle for remove_dataset_filter. DataSet filters apply to every consumer of the dataset (every Tablix / Chart bound to it); use list_tablix_filters for per-tablix filtering.

ParameterTypeDescription
dataset_name *string
path *string

add_dataset_filter

Append a <Filter> to the named dataset's <Filters> block. operator ∈ Equal / NotEqual / GreaterThan / LessThan / GreaterThanOrEqual / LessThanOrEqual / Like / In / Between / TopN / BottomN / TopPercent / BottomPercent. values must be non-empty (single-value filters use a one-element list). Returns the new filter's index for later removal. Optional field_format wraps the expression as Format(<body>, fmt) to coerce typed fields for string-parameter comparison. Response includes warnings for field/parameter type mismatches detected via best-effort cross-check.

ParameterTypeDescription
dataset_name *string
expression *stringFilterExpression — usually a Fields! reference.
operator *string
path *string
values *array
field_formatstringOptional format string (e.g. 'MMM, yyyy') wrapping the expression as Format(<body>, '<fmt>').

remove_dataset_filter

Remove a dataset-level filter by its 0-based document-order index. Cleans up the empty <Filters> block when removing the last entry.

ParameterTypeDescription
dataset_name *string
filter_index *integer
path *string

get_dataset

Single-DataSet read-back (parity with get_textbox / get_image / get_rectangle / get_chart / get_data_source). Returns dataset name, data_source, command_text, fields (with both data_field and value), query_parameters, filters, and designer_state_present.

ParameterTypeDescription
name *string
path *string

add_calculated_field

Append a calculated <Field> to the named dataset. Calculated fields carry an expression (<Value>) instead of a column reference (<DataField>); use them for derived fields like Total = Amount * Quantity that aren't in the source query but should be available via Fields!Name.Value. Refuses if a field of the same name already exists.

ParameterTypeDescription
dataset_name *string
expression *stringRDL expression, e.g. '=Fields!Amount.Value * Fields!Quantity.Value'.
field_name *string
path *string

remove_calculated_field

Remove a calculated <Field> by name. Refuses if the field is data-bound (carries <DataField> instead of <Value>) — those reflect the source query's columns. Drop a data-bound field via remove_dataset_field, or rewrite the dataset query via update_dataset_query.

ParameterTypeDescription
dataset_name *string
field_name *string
path *string

remove_dataset_field

Remove a data-bound <Field> by name (one with <DataField>). Symmetric counterpart to remove_calculated_field. Refuses on calculated fields (use remove_calculated_field instead) and on still-referenced fields (any expression containing Fields!<name>.Value / .IsMissing / .Count). Pass force=True to delete anyway. Closes the cookbook flow: refresh_dataset_fields lists orphans, remove_dataset_field drops them. Returns {dataset, removed, kind: 'DataBoundField'}.

ParameterTypeDescription
dataset_name *string
field_name *string
path *string
forcebooleanDefault false: refuse if the field is still referenced anywhere. true: delete anyway (prefer fixing the references first).

add_dataset_field

Append a data-bound <Field> to a dataset's <Fields> block. Writes <DataField>data_field</DataField> (and optional <rd:TypeName>type_name</rd:TypeName>). Distinct from add_calculated_field which writes <Value> for derived fields. Use after rewriting the DAX to declare a new column that came back from the query but isn't yet in <Fields>. Refuses on duplicate field name.

ParameterTypeDescription
data_field *stringSource column reference, e.g. 'Sales[ProductID]' or '[Region]' (the form depends on DAX shape).
dataset_name *string
field_name *string
path *string
type_namestring | null.NET type, e.g. 'System.String', 'System.DateTime', 'System.Decimal'. Optional.

refresh_dataset_fields

Sync a dataset's <Fields> block against the shape detected in its DAX <CommandText>. Eliminates the manual 'open Report Builder → right-click → Refresh Fields' step after a query rewrite. Recognises SELECTCOLUMNS aliases and Table[Col] tokens (SUMMARIZECOLUMNS / ad-hoc). Adds missing fields; lists orphans without auto-removing (caller decides what to drop). Returns {added, orphans, unchanged, warnings}. Cheap regex-based detection — bare EVALUATE 'Table' returns a warning.

ParameterTypeDescription
dataset_name *string
path *string

set_image_sizing

Set <Image>/<Sizing> on a named Image. sizing ∈ AutoSize / Fit / FitProportional / Clip. AutoSize renders at native size (box grows to fit); Fit stretches to fill (ignores aspect ratio); FitProportional preserves aspect ratio; Clip renders at native size, clipped to the box. Idempotent: same value → {changed: false}, no save.

ParameterTypeDescription
image_name *string
path *string
sizing *string

set_image_source

Repoint an existing <Image> at a different embedded image entry without delete-and-readd. Sets Source=Embedded and rewrites <Value> to embedded_name. Refuses with a clear error if embedded_name isn't in <EmbeddedImages> — leaving a dangling reference would render as a broken image. Add the image first via add_embedded_image. Idempotent: same (Source, Value) pair → {changed: false}, no save. Returns {name, kind, changed: bool}.

ParameterTypeDescription
embedded_name *string
image_name *string
path *string

set_column_width

Set <Width> on a tablix's body column. column accepts a 0-based integer index OR a textbox name living in any cell of that column (mirrors how set_cell_span / add_subtotal_row address columns). width is an RDL size ('1.5in', '4cm', '80pt'). Idempotent: same width → {changed: false}, no save.

ParameterTypeDescription
column *0-based column index or textbox name in any column cell.
path *string
tablix_name *string
width *string

set_tablix_size

Resize a tablix by writing <Height> and / or <Width> directly. Each arg independently optional. Use after adding header / footer rows that change the body's natural height — v0.2's positioning tools only cover top/left, not size. Both values are RDL size strings. Returns {tablix, kind, changed: list[str]} — empty list when inputs match existing.

ParameterTypeDescription
name *string
path *string
heightstring
widthstring

reorder_parameters

Reorder <ReportParameter> children to match the supplied names list. names MUST be a permutation of every existing parameter — no missing, no duplicates, no unknown names. When a <ReportParametersLayout> exists, its CellDefinition entries are reordered in lockstep so the parameter pane shows fields in the new declaration order. RowIndex / ColumnIndex are not recomputed (RB's layout grid is independent of declaration order). Returns {order, kind, changed: bool}; same order → no save.

ParameterTypeDescription
names *array
path *string

set_parameter_layout

Author <ReportParametersLayout>/<GridLayoutDefinition> explicitly. Writes <NumberOfRows> + <NumberOfColumns>; rewrites <CellDefinitions> so each name in parameter_order lands at (row=index // columns, col=index % columns). Strict permutation check (every existing parameter exactly once). rows*columns must be ≥ parameter count. Auto-creates the layout block when absent. Idempotent: same grid + order → no save. Complements reorder_parameters (declaration order) and sync_parameter_layout (gap-filling). Returns {rows, columns, order, kind, changed}.

ParameterTypeDescription
columns *integer
parameter_order *array
path *string
rows *integer

duplicate_report

Clone an .rdl to a new path. When regenerate_ids=true (default), every <rd:DataSourceID> and any <rd:ReportID> is rewritten to a fresh uuid4() so Power BI Report Builder doesn't refuse to load the duplicate due to identity collision. Atomic-write convention from RDLDocument.save_as. Refuses if dst_path already exists. Returns {src, dst, regenerated_ids: list[str]}.

ParameterTypeDescription
dst_path *string
src_path *string
regenerate_idsboolean

get_embedded_image_data

Read an embedded image's base64 <ImageData> for porting it to another report without re-reading from disk. Returns {name, mime_type, base64, byte_size}. base64 is the raw text of the ImageData element; byte_size is the decoded size for sanity-checking. Refuses with ElementNotFoundError if the named entry isn't in <EmbeddedImages>.

ParameterTypeDescription
name *string
path *string

validate_report

Run schema/structural validation against an .rdl. Returns {valid, errors, xsd_used}. Structural checks always run (root element + required top-level sections). The Microsoft RDL 2016/01 XSD is bundled by default since v0.3.1 — when it's loaded, xsd_used is True and the schema-conformance bug class Power BI Report Builder rejects on load gets caught here. If the bundled XSD is missing (source-build without package-data) a {severity:warning, rule:'xsd-not-bundled'} issue surfaces instead of silent skip. Each issue is {severity, rule, location, message, suggestion?}; valid is True iff no severi…

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

verify_report

One-shot static check: union of validate_report and lint_report. Returns {valid, issues, xsd_used} where valid is True iff no issue has severity='error'. Warnings (including 'xsd-not-bundled' when the schema file is missing) don't invalidate the report. Use this as the single 'is the report OK?' tool, or set PBIRB_MCP_AUTO_VERIFY=1 to have it run after every mutating call.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

lint_report

Run static-analysis lint rules against an .rdl. Sixteen rules cover the v0.2/v0.3 sweep bug classes (multi-value-eq, missing-field-reference, dangling-embedded-image, pbidataset-at-prefix, parameter-layout-out-of-sync, double-encoded-entities, stale-designer-state, tablix-span-misplaced, dataset-fields-out-of-sync, etc.). Returns {issues, rules_run} with each issue {severity, rule, location, message, suggestion?}. Optional `rules` selects a subset by name.

ParameterTypeDescription
path *string
rulesarrayOptional subset of rule names; default runs all 16.

dry_run_edit

Apply a list of {tool, args} ops to a tempfile clone of the report; return the unified diff and a verify (validate + lint) report. The original file is NEVER modified. The harness auto-injects `path` into each op's args, so callers don't supply it. On op failure, dispatch stops; partial diff + verify are still returned. Use this to preview risky multi-step edits before committing.

ParameterTypeDescription
ops *arraySequence of tool calls to dispatch against the tempfile.
path *string

start_editing_transaction

Open the report and start an editing transaction. Returns {transaction_id, path, expires_at}. Pass transaction_id to subsequent edit tools to mutate the live in-memory tree WITHOUT touching disk between calls — eliminates the per-edit parse+serialize round-trip. The transaction times out after PBIRB_MCP_TRANSACTION_TIMEOUT_S seconds (default 600); call commit_editing_transaction to flush or cancel_editing_transaction to discard. Refuses if an active transaction already owns this path.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

commit_editing_transaction

Lint the in-memory tree, save to disk once (atomic .tmp + rename), and deregister. Aborts (saved=False) if lint surfaces any severity='error' issue — the transaction stays OPEN so the caller can fix the offending state and re-commit. Returns {transaction_id, path, saved, verify}.

ParameterTypeDescription
transaction_id *string

cancel_editing_transaction

Discard a transaction. The in-memory tree is dropped; the on-disk file is unchanged from when the transaction was started. Returns {transaction_id, path, discarded}.

ParameterTypeDescription
transaction_id *string

apply_edits

Atomic batch: open once → apply ops → lint → save once. Opens an internal transaction against path, dispatches each {tool, args} op through the JSON-RPC tools/call path with transaction_id injected, and commits at the end. On any op failure or lint-error at commit, rolls back — disk is byte-identical to its pre-call state. Compare with dry_run_edit (clones to tempfile, never touches the real file): use dry_run_edit to preview a plan, apply_edits to land it. Returns {applied: [{tool, ok, result|error}], verify, committed}.

ParameterTypeDescription
ops *arrayOrdered list of tool calls to apply atomically.
path *string

create_report

Emit a minimal valid RDL from scratch at `path`. Refuses if `path` exists (no clobbering). Default page_setup is US Letter portrait with 1in margins; pass any subset of {page_height, page_width, margin_top, margin_bottom, margin_left, margin_right, body_width, body_height} to override. `datasource` is a forward-compat hook — pass {name, workspace_url, dataset_name, provider, integrated_security} to wire a real PBI XMLA endpoint (v0.4 commit 14); omit for a placeholder DataSource1 + DataSet1 stub the caller fills in via subsequent tools. Validates structurally + against the bundled XSD before…

ParameterTypeDescription
path *string
datasourceobject | null
page_setupobject | null

get_expression_reference

Return a static cheat-sheet of common RDL expression patterns: globals, parameters, fields, aggregates, conditionals, strings, dates. Each entry is {name, syntax, example, description}. Call this when authoring a textbox value or filter expression instead of guessing — and note the explicit encoding hint for the `&` concat operator.

count_where

Emit =Sum(IIf(<condition>, 1, 0)) — the SSRS conditional-count idiom. condition is an RDL expression body (no leading '='). Returns a complete top-level expression suitable for set_textbox_value or any RDL <Value> sink.

ParameterTypeDescription
condition *stringRDL expression body, e.g. 'Fields!Status.Value = "Active"'.

sum_where

Emit =Sum(IIf(<condition>, <field_expression>, 0)) — the SSRS conditional-sum idiom. Both args are expression bodies (no leading '=').

ParameterTypeDescription
condition *stringRDL expression body, e.g. 'Fields!Status.Value = "Active"'.
field_expression *stringValue to sum, e.g. 'Fields!Amount.Value'.

iif_format

Emit =IIf(<condition>, <true_value>, <false_value>). All three args are expression bodies (no leading '='); string literals must already be quoted, e.g. true_value='"Yes"'.

ParameterTypeDescription
condition *string
false_value *string
true_value *string

set_group_page_break

Set <BreakLocation> on a tablix group's page-break rule. location ∈ {None, Start, End, StartAndEnd, Between}. Passing 'None' removes the <PageBreak> element (the canonical 'no break' shape). Idempotent. Returns {tablix, group, kind: 'Group', location, changed}.

ParameterTypeDescription
group_name *string
location *string
path *string
tablix_name *string

set_repeat_on_new_page

Set <TablixMember>/<RepeatOnNewPage> on the member that wraps the named group. Most common use: repeat a group header row at the top of every page the group spans. Setting repeat=False removes the element (False is default). Returns {tablix, group, kind: 'TablixMember', repeat, changed}.

ParameterTypeDescription
group_name *string
path *string
repeat *boolean
tablix_name *string

set_keep_together

Set <KeepTogether> on a named Tablix / Rectangle / Chart / Textbox / Map / Gauge. Tells the renderer 'don't split this across pages if you can help it'. Best-effort — items larger than a page are still split. keep=False removes the element. Refuses for Image / Line / Subreport and other kinds where the RDL XSD doesn't allow it.

ParameterTypeDescription
keep *boolean
name *string
path *string

set_keep_with_group

Set <TablixMember>/<KeepWithGroup> on the member that wraps the named group. value ∈ {None, Before, After}. Typical use: a column-header row's member with 'After' to glue it to the data rows that follow. value='None' removes the element.

ParameterTypeDescription
group_name *string
path *string
tablix_name *string
value *string

add_rectangle

Add a <Rectangle> to <Body>/<ReportItems>. With no contained_items the rectangle is empty (a visual frame). With contained_items=[name1, name2, ...], each named body item is MOVED into the rectangle's <ReportItems> and its <Top>/<Left> recalculated so the on-screen position is preserved. Refuses on duplicate name or if any contained_item isn't in <Body>/<ReportItems>. Returns {name, kind: 'Rectangle', moved}.

ParameterTypeDescription
height *string
left *string
name *string
path *string
top *string
width *string
contained_itemsarrayOptional names of existing body items to move into the rectangle. Omit or pass [] for an empty rectangle (visual frame).

add_list

Add a List (single-cell repeating Tablix) bound to a dataset. RDL has no distinct <List> element — Report Builder's List is a Tablix with one column, one detail row, and a Rectangle inside the cell. Items placed in the rectangle repeat once per dataset row. The inner rectangle is named '<name>_Rect' for subsequent lookup. Returns {name, kind: 'Tablix', dataset, rectangle}.

ParameterTypeDescription
dataset_name *string
height *string
left *string
name *string
path *string
top *string
width *string

add_line

Add a <Line> to <Body>/<ReportItems>. RDL Line semantics: top/left is the start point; width/height is the offset (vector) to the end point — horizontal line uses height='0in', vertical uses width='0in'. Optional color, line_thickness ('1pt' default), line_style (Solid/Dashed/Dotted/Double/etc.). Returns {name, kind: 'Line'}.

ParameterTypeDescription
height *string
left *string
name *string
path *string
top *string
width *string
colorstring
line_stylestring
line_thicknessstring

raw_xml_view

Read-only XPath query against the report. Returns matched elements as serialised XML strings. XPath context is <Report> (the root); 'r:' is bound to the RDL namespace, 'rd:' to the rd namespace. Examples: "r:DataSources/r:DataSource[@Name='X']" / ".//r:Textbox[@Name='X']/r:Style". Returns [] when nothing matches; raises on malformed xpath.

ParameterTypeDescription
path *string
xpath *string

raw_xml_replace

Replace the single element matched by xpath with new content. content is parsed with RDL as the default namespace and 'rd:' bound, so bare names like <Textbox><Value>x</Value></Textbox> work without explicit xmlns. Refuses on zero matches, multiple matches, or if the xpath targets the <Report> root. Saves atomically. Returns {xpath, kind, changed}.

ParameterTypeDescription
content *stringXML for the replacement element. Exactly one top-level element.
path *string
xpath *string

set_textbox_action

Set <Textbox>/<Action> to a Hyperlink (URL), Drillthrough (another report + optional parameters), or BookmarkLink (jump within document). target_expression accepts literal text or =expression. drillthrough_parameters is a list of {name, value} dicts wired into <Drillthrough>/<Parameters>. Idempotent: same action_type + target + parameters → {changed: false}, no save.

ParameterTypeDescription
action_type *string
path *string
target_expression *string
textbox_name *string
drillthrough_parametersarray

set_image_action

Same shape as set_textbox_action but operates on a named <Image>. action_type ∈ Hyperlink / Drillthrough / BookmarkLink. Returns {image, kind, action_type, changed}.

ParameterTypeDescription
action_type *string
image_name *string
path *string
target_expression *string
drillthrough_parametersarray

set_textbox_tooltip

Set <Textbox>/<ToolTip>. Literal text or =expression. Pass '' to clear. Idempotent. Returns {textbox, kind, changed: bool}.

ParameterTypeDescription
path *string
text_or_expression *string
textbox_name *string

set_document_map_label

Set <DocumentMapLabel> on any named ReportItem (Textbox / Image / Rectangle / Chart / Tablix / etc.). Surfaces in the rendered report's navigable document-map / table-of-contents pane. Pass '' to clear. Idempotent. Returns {element, kind, changed: bool}.

ParameterTypeDescription
element_name *string
label_or_expression *string
path *string

set_chart_series_action

Set <ChartSeries>/<Action> to a Hyperlink (URL), Drillthrough (another report + optional parameters), or BookmarkLink. Same kwarg surface as set_textbox_action / set_image_action; the chart series is addressed by (chart_name, series_name). Schema-aware insertion respects ChartSeries child order. Idempotent on structural equality of the inner block.

ParameterTypeDescription
action_type *string
chart_name *string
path *string
series_name *string
target_expression *string
drillthrough_parametersarray

remove_query_parameter

Remove a query parameter from a dataset. Cleans up the empty <QueryParameters/> block when removing the last one.

ParameterTypeDescription
dataset_name *string
name *string
path *string

list_tablix_filters

List all filters on a named tablix in document order. Returns expression, operator, and values per filter; index in the list is the stable handle for remove_tablix_filter.

ParameterTypeDescription
path *string
tablix_name *string

add_tablix_filter

Append a <Filter> to a tablix. Operator must be one of the RDL 2016 enumeration (Equal, NotEqual, GreaterThan, In, Between, ...). Returns the new filter's index for follow-up calls. Optional field_format wraps the expression as Format(<body>, fmt) to coerce typed fields for string-parameter comparison. The response includes warnings for cross-checked field/parameter type mismatches.

ParameterTypeDescription
expression *string
operator *string
path *string
tablix_name *string
values *array
field_formatstringOptional format string (e.g. 'MMM, yyyy') wrapping the expression as Format(<body>, '<fmt>').

add_row_group

Add a row group that wraps the entire current top-level row hierarchy. Inserts a matching group-header row at body row 0 with the group expression in the first cell. parent_group (nesting under an existing group) is reserved for a future commit and currently raises NotImplementedError.

ParameterTypeDescription
group_expression *stringRDL expression, e.g. =Fields!Region.Value
group_name *string
path *string
tablix_name *string
parent_groupstring | null

remove_row_group

Inverse of add_row_group: unwraps a group's children back to its parent hierarchy and removes the matching header row at body row 0. Refuses to remove the conventional Details group.

ParameterTypeDescription
group_name *string
path *string
tablix_name *string

convert_to_matrix

Convert a row-grouped + column-grouped tablix into a matrix by dropping the residual Details row group and its body row. Pre-conditions (all checked): the named row_group and column_group must already exist (call add_row_group + add_column_group first); a <Group Name='Details'> must still be present in the row hierarchy. Refuses on second call (already a matrix). Use this after the standard insert_tablix_from_template + add_row_group + add_column_group flow to make the leaf the row group instead of Details — without this, cells render at detail granularity. Pair with set_tablix_corner (v0.4…

ParameterTypeDescription
column_group *string
path *string
row_group *string
tablix_name *string

set_tablix_corner

Write the <TablixCorner> block — the top-left cell of a matrix-shaped tablix that holds the row-axis caption (e.g. 'Type'). Pass `text` for a literal value OR `expression` for a VB.NET '=...' formula. Mutually exclusive. Textbox name is deterministic: '<tablix_name>_Corner'. Refuses if the tablix has no named column group (the corner is only meaningful in a matrix). Replaces any existing TablixCorner block. Returns {tablix, name, kind: 'TablixCorner', changed}.

ParameterTypeDescription
path *string
tablix_name *string
expressionstring | null
textstring | null

set_group_sort

Replace a group's <SortExpressions> with a fresh list. Each entry is an RDL expression, e.g. =Fields!Region.Value.

ParameterTypeDescription
group_name *string
path *string
sort_expressions *array
tablix_name *string

set_group_visibility

Set <Visibility> on a group's TablixMember. Accepts a Hidden expression and an optional ToggleItem (a textbox name that toggles the group expand/collapse).

ParameterTypeDescription
group_name *string
path *string
tablix_name *string
visibility_expression *string
toggle_textboxstring | null

add_column_group

Add a column group that wraps the current top-level column hierarchy. Inserts a matching column at body column 0 (default 1in width) and a header cell at column 0 of every existing row with the group expression in the topmost cell. Mirrors add_row_group on the column axis. parent_group nesting is reserved for a future commit and currently raises NotImplementedError.

ParameterTypeDescription
group_expression *stringRDL expression, e.g. =Fields!Region.Value
group_name *string
path *string
tablix_name *string
parent_groupstring | null

remove_column_group

Inverse of add_column_group: unwraps a column-axis group's children back to the top of the column hierarchy and removes the matching body column at position 0 (along with each row's first cell). Errors if group_name only exists on the row axis.

ParameterTypeDescription
group_name *string
path *string
tablix_name *string

set_column_group_sort

Replace a column-axis group's <SortExpressions> with a fresh list. Mirrors set_group_sort but refuses up front if group_name is on the row axis (use set_group_sort instead).

ParameterTypeDescription
group_name *string
path *string
sort_expressions *array
tablix_name *string

set_column_group_visibility

Set <Visibility> on a column-axis group's TablixMember. Accepts a Hidden expression and an optional ToggleItem (textbox name that toggles expand/collapse). Mirrors set_group_visibility but refuses up front if group_name is on the row axis.

ParameterTypeDescription
group_name *string
path *string
tablix_name *string
visibility_expression *string
toggle_textboxstring | null

add_tablix_column

Append (or insert) a column into a tablix. column_name is the textbox name placed in the data row's new cell — must be unique report-wide. expression goes inside that textbox's TextRun (typically =Fields!X.Value). For a tablix with >= 2 rows the first row gets header_text (default = column_name) as a literal, middle rows get blank cells, and the last row gets expression. position is 0-indexed; default appends at end. width defaults to 1in. Inserts a matching top-level TablixMember in the column hierarchy at the same index.

ParameterTypeDescription
column_name *string
expression *string
path *string
tablix_name *string
header_textstring | null
positioninteger | null
widthstring | null

remove_tablix_column

Remove the tablix column whose data-row cell holds a textbox named column_name. Drops the matching TablixColumn, removes the top-level TablixMember at that column index (only if it's a leaf, never a column group wrapper), and removes the cell at that index from every TablixRow. Errors if no row contains a textbox with the given name.

ParameterTypeDescription
column_name *string
path *string
tablix_name *string

add_subtotal_row

Append a subtotal row to a row-axis group. aggregates is a list of {column, expression} entries; column matches against the Details row's textbox names (the same names add_tablix_column uses as column_name — NOT field names). expression is the aggregate (e.g. =Sum(Fields!X.Value)). Columns not listed get blank cells. position='footer' (default) appends; 'header' inserts at body row 1 (right after the group-header row). Group must have been added via add_row_group.

ParameterTypeDescription
aggregates *array
group_name *string
path *string
tablix_name *string
positionstring

add_subtotal_column

Column-axis mirror of add_subtotal_row. Adds a static TablixMember inside the column-group's <TablixMembers>, a new <TablixColumn> in TablixBody, and a cell at the new column index in every body row. aggregates is a list of {row, expression} entries where row is the 0-based body row index; rows not listed get blank cells. position='after' (default — canonical Grand Total slot, appends to the right of the column group) or 'before' (prepends to the group's left edge). width defaults to '1in'. Group must have been added via add_column_group.

ParameterTypeDescription
aggregates *array
group_name *string
path *string
tablix_name *string
positionstring
widthstring

set_cell_span

Set <RowSpan> and/or <ColSpan> on a tablix cell. The cell is addressed by (row_index, column_name) where column_name is the textbox name inside the cell. At least one of row_span / col_span must be supplied; both must be >= 1. Pass 1 to explicitly reset a span. Replaces existing values if present.

ParameterTypeDescription
column_name *string
path *string
row_index *integer
tablix_name *string
col_spaninteger | null
row_spaninteger | null

add_static_row

Add a static (no-group) row to a tablix. Each cell holds literal text. cells is a list of strings, one per body column (left to right); shorter list = blank trailing cells, longer list errors. Cell textboxes are named row_name (col 0) and row_name_<col_index> (others) — unique report-wide so row_name must not clash with any existing textbox. position is 0-indexed; default appends. height defaults to 0.25in.

ParameterTypeDescription
path *string
row_name *string
tablix_name *string
cellsarray | null
heightstring | null
positioninteger | null

add_static_column

Add a static (no-group) column to a tablix. Each cell holds literal text. cells is a list of strings, one per body row (top to bottom); shorter list = blank trailing cells, longer list errors. Cell textboxes are named column_name (row 0) and column_name_<row_index> (others). position is 0-indexed; default appends. width defaults to 1in.

ParameterTypeDescription
column_name *string
path *string
tablix_name *string
cellsarray | null
positioninteger | null
widthstring | null

set_body_item_position

Move an existing named ReportItem inside <Body> to (top, left). Preserves all other properties (size, style, group structure). top and left are passed through verbatim — RDL accepts any size unit (2cm, 0.75in, 108pt). Errors if no body item by that name.

ParameterTypeDescription
left *string
name *string
path *string
top *string

set_header_item_position

Move an existing named ReportItem inside <PageHeader> to (top, left). Errors if there is no <PageHeader> (call set_page_header first) or no item by that name.

ParameterTypeDescription
left *string
name *string
path *string
top *string

set_body_item_size

Resize an existing named ReportItem inside <Body>. At least one of width / height must be supplied; missing fields are left untouched. Same RDL size-string convention as the position tools.

ParameterTypeDescription
name *string
path *string
heightstring | null
widthstring | null

set_header_item_size

Resize a named item inside <PageHeader>. Mirrors set_body_item_size — at least one of width / height; missing fields untouched; idempotent ({changed: false} when nothing differs). Closes the v0.2 parity gap where only the body variant existed.

ParameterTypeDescription
name *string
path *string
heightstring | null
widthstring | null

list_body_items

List every named ReportItem at the top level of <Body>. Returns name, type (Tablix / Textbox / Image / Rectangle / Subreport / Chart / etc.), top, left, width, height. Use before set_body_item_position / set_body_item_size when you don't already know what's in the body.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

list_header_items

Same shape as list_body_items but for <PageHeader>.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

get_textbox

Return effective state of a named Textbox: position, size, Visibility, CanGrow, CanShrink, plus a nested style dict that mirrors set_textbox_style's routing — {box: {BackgroundColor, VerticalAlign, padding, ...}, border: {Style, Color, Width}, paragraph: {TextAlign}, run: {FontFamily, FontSize, FontWeight, Color, Format, ...}}. Empty branches are dropped. runs[] entries each carry their own per-run style. Searches the entire report; tablix-cell textboxes have None for top/left/width/height. Top-level positioned items with a missing <Top> or <Left> coerce to '0in' (RDL default).

ParameterTypeDescription
name *string
path *string

get_image

Return effective state of a named Image: position, size, Source (External / Embedded / Database), Value, Sizing (AutoSize / Fit / FitProportional / Clip), MIMEType, Style, Visibility.

ParameterTypeDescription
name *string
path *string

get_rectangle

Return effective state of a named Rectangle: position, size, names of contained ReportItems, Style, Visibility.

ParameterTypeDescription
name *string
path *string

get_chart

Return effective state of a named Chart: position, size, dataset, palette, series list (name/type/subtype/value expression/color), category groups (name/expression/label), axes (category and value), legend, title, Style, Visibility. Symmetric with get_textbox / get_image / get_rectangle.

ParameterTypeDescription
name *string
path *string

backup_report

Copy the report to <path>.bak.<UTC-timestamp>. Original is untouched. Cheap explicit checkpoint to call before a destructive batch (remove_*, rename_parameter, etc.). Returns the backup path. Set PBIRB_MCP_AUTO_BACKUP=1 to opt into automatic backups before destructive ops (off by default).

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

restore_from_backup

Restore a backup file over its original target. target_path defaults to the path implied by the backup's <target>.bak.<UTC-timestamp> filename; pass target_path explicitly when the backup name doesn't match that shape. Refuses if target mtime is newer than backup (staleness guard) — pass force=True to override. Returns {source, restored_to, bytes_restored}.

ParameterTypeDescription
backup_path *string
forceboolean
target_pathstring | null

set_parameter_prompt

Write the <Prompt> text on a ReportParameter. Empty string clears the <Prompt> element entirely; pass a single space ' ' for blank-but-present.

ParameterTypeDescription
name *string
path *string
prompt *string

set_parameter_type

Set <DataType> on a ReportParameter. type ∈ {Boolean, DateTime, Integer, Float, String}. Rejects with ValueError if any existing literal default value would be incompatible with the new type — fix defaults first via set_parameter_default_values, then retry.

ParameterTypeDescription
name *string
path *string
type *string

add_parameter

Create a new ReportParameter with a minimal valid declaration. Appends to <ReportParameters> (creating it if absent). Pair with set_parameter_available_values / set_parameter_default_values afterwards for value lists. Booleans are only emitted when an explicit value is supplied.

ParameterTypeDescription
name *string
path *string
type *string
allow_blankboolean | null
allow_nullboolean | null
hiddenboolean | null
multi_valueboolean | null
promptstring | null

remove_parameter

Remove a ReportParameter by name. Refuses (lists offending locators) if the parameter is still referenced anywhere in the report by Parameters!<name>.Value or .Label. Pass force=True to remove anyway.

ParameterTypeDescription
name *string
path *string
forceboolean

rename_parameter

Rename a ReportParameter and rewrite every textual occurrence of Parameters!<old_name>.Value / .Label across the entire report. Case-sensitive. Atomic: collects all matches first, then commits. Errors if new_name already exists or equals old_name.

ParameterTypeDescription
new_name *string
old_name *string
path *string

sync_parameter_layout

Bring <ReportParametersLayout>/<GridLayoutDefinition>/<CellDefinitions> into sync with <ReportParameters>. Drops cells whose ParameterName no longer exists; appends cells for parameters that have no entry, placed at the next free (row, col) slot. add_parameter / remove_parameter / rename_parameter call this internally; the standalone tool is for repairing legacy reports authored before v0.3.0 where the layout drifted. No-op when the report has no <ReportParametersLayout>. Returns {added, removed}.

ParameterTypeDescription
path *stringAbsolute path to the .rdl file to read.

set_detail_row_visibility

Set <Visibility> on the tablix's Details group, optionally with a ToggleItem textbox name. Use to hide detail rows by expression without restructuring the row hierarchy.

ParameterTypeDescription
expression *string
path *string
tablix_name *string
toggle_textboxstring | null

set_row_height

Set the Height of the Nth body row (0-indexed) in a tablix. Accepts any RDL size string ('0.25in', '1cm', '12pt').

ParameterTypeDescription
height *string
path *string
row_index *integer
tablix_name *string

remove_tablix_filter

Remove a filter by index. Filters are anonymous in RDL, so use list_tablix_filters first to find the right index. Removing the last filter also drops the empty <Filters/> block.

ParameterTypeDescription
filter_index *integer
path *string
tablix_name *string

set_page_setup

Update <Page> dimensions, margins, and column count on the first ReportSection. All fields are optional — only what's passed gets written. columns=1 strips the <Columns/> element.

ParameterTypeDescription
path *string
columnsinteger | null
margin_bottomstring | null
margin_leftstring | null
margin_rightstring | null
margin_topstring | null
page_heightstring | null
page_widthstring | null

set_page_orientation

Set page orientation by swapping PageHeight and PageWidth when the current orientation doesn't match the requested one. Idempotent. Accepts 'Portrait' or 'Landscape'.

ParameterTypeDescription
orientation *string
path *string

set_body_size

Set the body's rendering region inside the page. <Body>/<Height> and <ReportSection>/<Width> (the sibling of <Body>) — both are RDL size strings (e.g. '14in', '9in', '297mm'). Either or both kwargs required. Distinct from set_page_setup (which sets the paper chrome <Page>/<PageWidth>/<PageHeight>) and set_body_item_size (size of items inside the body). Use this when a wide tablix or chart needs the body region expanded — without it the right edge is clipped at preview time. Idempotent: same value → empty changed. Returns {kind: 'Body', changed: list[str]}.

ParameterTypeDescription
path *string
heightstring | null
widthstring | null

set_page_header

Create or update <PageHeader>: height plus PrintOnFirstPage / PrintOnLastPage flags. All fields optional — only what's passed gets written.

ParameterTypeDescription
path *string
heightstring | null
print_on_first_pageboolean | null
print_on_last_pageboolean | null

add_header_textbox

Add a Textbox to <PageHeader>/<ReportItems>. text accepts static strings or RDL expressions (=Parameters!DateFrom.Value). Pass raw text — encoding is handled; don't pre-encode XML entities (use `&` not `&amp;`, including for the VB.NET string-concat operator in expressions).

ParameterTypeDescription
height *string
left *string
name *string
path *string
text *stringStatic text or RDL expression (=...).
top *string
width *string

add_header_image

Add an Image to <PageHeader>/<ReportItems>. image_source is External (URL in value), Embedded (EmbeddedImage Name in value), or Database (=Fields!Photo.Value-style expression).

ParameterTypeDescription
height *string
image_source *string
left *string
name *string
path *string
top *string
value *stringURL for External, embedded-image name for Embedded, or =Fields!X.Value for Database.
width *string

remove_header_item

Remove a named Textbox or Image from <PageHeader>/<ReportItems>. Empties the ReportItems block when the last item leaves.

ParameterTypeDescription
name *string
path *string

set_textbox_style

Set styling on a named Textbox. Properties route to the right nested Style node automatically: background_color, border_*, vertical_align, padding_*, writing_mode go on Textbox/Style; text_align on Paragraph/Style; font_*, color, format on TextRun/Style; can_grow / can_shrink go DIRECTLY on Textbox (not inside Style). All fields optional — only what's passed gets written. Cell-level styling: every tablix cell is a Textbox with a unique name, so use this tool with the cell's textbox name (e.g. 'HeaderAmount').

ParameterTypeDescription
path *string
textbox_name *string
background_colorstring | null
border_colorstring | null
border_stylestring | nullNone | Solid | Dotted | Dashed | Double.
border_widthstring | null
can_growboolean | nullAllow textbox to grow vertically when content exceeds the height. Direct Textbox child, not Style.
can_shrinkboolean | nullAllow textbox to shrink when content is shorter than the height. Direct Textbox child, not Style.
colorstring | nullText color — '#RRGGBB' or named.
font_familystring | null
font_sizestring | nullRDL size, e.g. '11pt'.
font_weightstring | nullNormal | Bold | Lighter | ... or numeric.
formatstring | nullNumber/date format (e.g. '#,0.00', 'C2', 'd').
padding_bottomstring | null
padding_leftstring | null
padding_rightstring | null
padding_topstring | nullRDL size (e.g. '2pt', '0.05in').
text_alignstring | nullLeft | Center | Right | Justify | General.
vertical_alignstring | nullTop | Middle | Bottom.
writing_modestring | nullHorizontal | Vertical | Rotate270 — text orientation. Useful for narrow column headers.

set_textbox_runs

Replace a textbox's content with multiple <TextRun> children for mixed styling within one display — e.g. '**Asset(s):** value' with a bold prefix + regular value in a single textbox. Each run is a dict with required 'text' and optional font_family / font_size / font_weight / font_style / color / format / text_decoration. Replaces the entire <Paragraphs> subtree (single-paragraph in v0.3; multi-paragraph deferred). Round-trip contract: get_textbox.runs[] returns the same shape this tool writes. Idempotent — identical input is a no-op short-circuit. Returns {textbox, kind, runs, changed}. Pa…

ParameterTypeDescription
path *string
runs *array
textbox_name *string

set_textbox_value

Replace the text content of a single-run textbox. value can be raw text or an =expression. Use this for the everyday 'change the textbox content' case (swap a literal label, update a stale parameter reference, replace a broken aggregate). Refuses with a redirect to set_textbox_runs when the textbox has multiple text runs (multi-run content needs the rich-text editor). Idempotent: identical value → {changed: false} no-op. Returns {textbox, kind, changed}. Pass raw text — encoding is handled; don't pre-encode XML entities (use `&` not `&amp;`, including for the VB.NET string-concat operator…

ParameterTypeDescription
path *string
textbox_name *string
value *string

set_textbox_style_bulk

Apply the same style kwargs to every named textbox in one call. Same kwarg surface as set_textbox_style. Missing names land in skipped rather than raising. Returns {textboxes, skipped, changed} where changed is the union of sub-paths affected across all textboxes. Pair with find_textboxes_by_style to discover names by current style.

ParameterTypeDescription
path *string
textbox_names *array
background_colorstring | null
border_colorstring | null
border_stylestring | null
border_widthstring | null
can_growboolean | null
can_shrinkboolean | null
colorstring | null
font_familystring | null
font_sizestring | null
font_weightstring | null
formatstring | null
padding_bottomstring | null
padding_leftstring | null
padding_rightstring | null
padding_topstring | null
text_alignstring | null
vertical_alignstring | null
writing_modestring | null

find_textboxes_by_style

Search for textboxes matching one or more style filters. Filters AND together (every supplied filter must match). Returns [{name, location, matched_fields}] where location is best-effort 'body' / 'header' / 'footer' / 'tablix:<name>' / 'rectangle:<name>'. Returns [] when no filters supplied. Pair with set_textbox_style_bulk for discovery+apply patterns (e.g. 'recolor every red textbox').

ParameterTypeDescription
path *string
background_colorstring
border_colorstring
border_stylestring
border_widthstring
colorstring
font_familystring
font_sizestring
font_stylestring
font_weightstring
formatstring
padding_bottomstring
padding_leftstring
padding_rightstring
padding_topstring
text_alignstring
text_decorationstring
vertical_alignstring
writing_modestring

find_textbox_by_value

Find every Textbox whose <Value> text matches a Python regex pattern. Searches Body / PageHeader / PageFooter. A textbox with multiple matching runs surfaces once per match. Returns [{textbox, value, region}]. Useful for finding stale =Parameters!Old.Value references after rename_parameter, or any cross-cutting expression edit.

ParameterTypeDescription
path *string
pattern *stringPython regex (re.search); not RDL/SQL glob.

style_tablix_row

Apply the same style kwargs to every cell in a tablix row in ONE call. Replaces the 12-individual-set_textbox_style-calls-per-row pattern. row accepts: integer (0-based body row index), 'header' (first leaf with KeepWithGroup=After — the column header row), 'details' (the Details leaf row), '<group>_header' (header row of a named row group), '<group>_footer' (footer row when present, e.g. after add_subtotal_row). Same style kwargs as set_textbox_style (font_*, color, background_color, border_*, padding_*, writing_mode, can_grow, can_shrink, etc.). Delegates writes to set_textbox_style_bulk.…

ParameterTypeDescription
path *string
row *Integer index, or one of: 'header', 'details', '<group>_header', '<group>_footer'.
tablix_name *string
background_colorstring | null
border_colorstring | null
border_stylestring | null
border_widthstring | null
can_growboolean | null
can_shrinkboolean | null
colorstring | null
font_familystring | null
font_sizestring | null
font_weightstring | null
formatstring | null
padding_bottomstring | null
padding_leftstring | null
padding_rightstring | null
padding_topstring | null
text_alignstring | null
vertical_alignstring | null
writing_modestring | null

add_body_textbox

Add a Textbox to <Body>/<ReportItems>. text accepts static strings or RDL expressions (e.g. =Globals!ReportName). Coexists with the existing tablix; rejects names already in use. Pass raw text — encoding is handled; don't pre-encode XML entities (use `&` not `&amp;`, including for the VB.NET string-concat operator in expressions).

ParameterTypeDescription
height *string
left *string
name *string
path *string
text *stringStatic text or RDL expression (=...).
top *string
width *string

add_body_image

Add an Image to <Body>/<ReportItems>. image_source: External (URL), Embedded (EmbeddedImage Name), Database (=Fields!Photo.Value).

ParameterTypeDescription
height *string
image_source *string
left *string
name *string
path *string
top *string
value *string
width *string

remove_body_item

Remove a named item (Textbox, Image, or Tablix) from <Body>/<ReportItems>. Destructive but explicit — raises if the name doesn't match anything.

ParameterTypeDescription
name *string
path *string

insert_tablix_from_template

Build and append a basic Tablix to <Body>/<ReportItems>. One column per name in `columns`; header row gets the column name as a static label, detail row binds to =Fields!<column>.Value. dataset_name must already exist. `width` is the tablix outer width — each column defaults to 1in regardless, so for a 3-column tablix the columns sum to 3in even if you pass width=10cm. Resize columns afterwards via direct edits or future column-width tools.

ParameterTypeDescription
columns *array
dataset_name *string
height *string
left *string
name *string
path *string
top *string
width *string

insert_chart_from_template

Build and append a basic Column chart to <Body>/<ReportItems>. Single category axis grouped by category_field; single Y series Sum(Fields!<value_field>.Value). dataset_name must already exist. Change <Type> post-insert (e.g. to Bar / Line / Pie) by editing the chart directly.

ParameterTypeDescription
category_field *string
dataset_name *string
height *string
left *string
name *string
path *string
top *string
value_field *string
width *string

add_chart_series

Append a new <ChartSeries> to a named chart. value_field is the dataset field whose Sum becomes the Y expression (=Sum(Fields!<value_field>.Value)). series_type defaults to Column; combine series of different types in one chart for combo charts (e.g. Bar + Line). series_subtype defaults to Plain. Refuses if series_name already exists.

ParameterTypeDescription
chart_name *string
path *string
series_name *string
value_field *string
series_subtypestringPlain / Stacked / PercentStacked / Smooth / Exploded / SmoothLine / 100 / Line / Spline
series_typestringColumn / Bar / Line / Area / Pie / Doughnut / Range / Scatter / Bubble / Stock / Polar / Radar / Funnel / Pyramid

remove_chart_series

Remove a named <ChartSeries> from a chart. Refuses to remove the last remaining series (use remove_body_item to drop the whole chart instead). Returns {chart, removed, remaining}.

ParameterTypeDescription
chart_name *string
path *string
series_name *string

set_chart_series_type

Update <Type> and optionally <Subtype> on a named ChartSeries. Combo charts work by setting different types per series in the same chart (e.g. one Bar series and one Line series). v0.4: series_subtype defaults to null/None — omit to PRESERVE the existing subtype. Pass 'Stacked' / 'PercentStacked' / 'Plain' / etc. to override. Pre-v0.4 always wrote 'Plain' by default, silently resetting stacked-bar charts on type-only edits. Returns {chart, series, kind, changed: list[str]} — empty when inputs match existing values.

ParameterTypeDescription
chart_name *string
path *string
series_name *string
series_type *string
series_subtypestring | null

set_chart_series_grouping

Promote a chart's static ChartMember to a dynamic-fanout series. Writes <ChartSeriesHierarchy>/<ChartMembers>/<ChartMember>/<Group Name='<series>_Group'>/<GroupExpressions>/<GroupExpression>. At render time, one rendered series is produced per distinct value of the group expression — the '13 violation types unknown at design time' fan-out. group_field='Type' is a shorthand for =Fields!Type.Value; group_expression accepts any VB.NET. Mutually exclusive. replace=False (default) refuses if the ChartMember already has a <Group>; pass replace=True to overwrite. Operates on the FIRST ChartMember i…

ParameterTypeDescription
chart_name *string
path *string
series_name *string
group_expressionstring | null
group_fieldstring | null
replaceboolean

set_chart_axis

Configure a chart axis: title (Caption), format (numeric/date format string in <Style>/<Format>), min/max range, log_scale, interval, visible. axis ∈ {Category, Value}; axis_name defaults to 'Primary' (the only axis the template emits — pass a real name for secondary axes). All field args are optional; pass '' to clear an element. Returns {chart, axis, axis_name, kind, changed: list[str]} with the affected sub-element names.

ParameterTypeDescription
axis *stringCategory or Value
chart_name *string
path *string
axis_namestring
formatstringNumeric/date format, e.g. '#,0.00' or 'MMM yyyy'.
intervalstring
log_scaleboolean
maxstring
minstring
titlestring
visibleboolean

set_chart_legend

Configure a chart legend: position (TopLeft / TopCenter / TopRight / LeftTop / LeftCenter / LeftBottom / RightTop / RightCenter / RightBottom / BottomLeft / BottomCenter / BottomRight) and visible (writes <Hidden>true|false</Hidden>). legend_name defaults to 'Default' (the only one the template emits). Returns {chart, legend, kind, changed: list[str]}; no-op short-circuit when nothing supplied.

ParameterTypeDescription
chart_name *string
path *string
legend_namestring
positionstring
visibleboolean

set_chart_data_labels

Configure <ChartDataLabel> on one or all series in a chart. When series_name is None, the change applies to every series; otherwise only the named series. visible writes <Visible>true|false</Visible>; visible_expression writes the same element with a VB.NET =IIf(...) expression (mutually exclusive with visible). format writes <Style>/<Format>; pass '' to clear. v0.4: position ∈ Auto/Top/TopLeft/TopCenter/TopRight/Left/Center/Right/BottomLeft/BottomCenter/BottomRight/Bottom/Outside; use_value_as_label ∈ true/false; font_weight + color write to <Style>/<FontWeight> and <Style>/<Color> (pass…

ParameterTypeDescription
chart_name *string
path *string
colorstring
font_weightstring
formatstring
positionstring
series_namestring
use_value_as_labelboolean
visibleboolean
visible_expressionstring

set_chart_palette

Set <Palette> on a chart. palette ∈ Default / EarthTones / Excel / GrayScale / Light / Pastel / SemiTransparent / Berry / Chocolate / Fire / SeaGreen / BrightPastel. Pass '' to clear (RB falls back to its built-in default palette). Returns {chart, kind, changed: bool}.

ParameterTypeDescription
chart_name *string
palette *string
path *string

set_series_color

Write <Color> into a named series's <Style> block, overriding the chart palette for just that series. color accepts a named color ('Red'), a hex string ('#FF0000'), or an =expression. Pass '' to clear (series falls back to the palette). Returns {chart, series, kind, changed: bool}.

ParameterTypeDescription
chart_name *string
color *string
path *string
series_name *string

set_chart_title

Update <ChartTitle>/<Caption>. text can be literal text or an =expression. title_name defaults to 'Default' (the only title the template emits). Returns {chart, title, kind, changed: bool}.

ParameterTypeDescription
chart_name *string
path *string
text *string
title_namestring

set_parameter_available_values

Set or clear <ValidValues> on a report parameter. source='static' with a non-empty static_values writes a list of <ParameterValue> entries (each entry can be a string or {value, label} dict). source='static' with static_values=[] or omitted CLEARS the <ValidValues> element entirely (mirrors set_parameter_prompt('') and returns cleared=true). source='query' writes a <DataSetReference> to a lookup dataset. Replaces any existing <ValidValues> block.

ParameterTypeDescription
name *string
path *string
source *string
query_datasetstring | null
query_label_fieldstring | null
query_value_fieldstring | null
static_valuesarray | null

set_parameter_default_values

Set or clear <DefaultValue> on a report parameter. source='static' with a non-empty static_values writes a <Values> list of expressions. source='static' with static_values=[] or omitted CLEARS the <DefaultValue> element entirely (mirrors set_parameter_prompt('') and returns cleared=true). source='query' writes a <DataSetReference> with ValueField only (no LabelField — defaults are values, not display strings). Replaces any existing block.

ParameterTypeDescription
name *string
path *string
source *string
query_datasetstring | null
query_value_fieldstring | null
static_valuesarray | null

update_parameter_advanced

Toggle the four boolean flags on a report parameter: multi_value, hidden, allow_null (writes <Nullable>), allow_blank. Each is independently optional. With no flags passed it's a no-op. Cascading parameters are NOT a flag — use set_parameter_available_values(source='query') + add_query_parameter on the lookup dataset to wire a dependency on another parameter.

ParameterTypeDescription
name *string
path *string
allow_blankboolean | null
allow_nullboolean | null
hiddenboolean | null
multi_valueboolean | null

add_embedded_image

Read a real image file off disk, base64-encode it, and store it under <EmbeddedImages>. Reference it later with image_source='Embedded' + value=<name>. Supported MIME types: image/bmp, image/gif, image/jpeg, image/png, image/x-png. The file's magic bytes are sniffed and must match mime_type — claiming PNG bytes as image/jpeg is rejected here rather than letting Report Builder fail at preview time.

ParameterTypeDescription
image_path *stringFilesystem path to the source image.
mime_type *string
name *string
path *string

list_embedded_images

List embedded images in the report by name and MIME type. Returns an empty list when <EmbeddedImages> is absent.

ParameterTypeDescription
path *string

remove_embedded_image

Remove a named embedded image. Refuses (lists offending Image elements) when any <Image Source="Embedded"><Value>=name> still references it; pass force=True to remove anyway and accept the dangling references. Drops the empty <EmbeddedImages/> block when removing the last entry.

ParameterTypeDescription
name *string
path *string
forceboolean

set_alternating_row_color

Zebra-stripe a tablix's detail row by writing BackgroundColor=IIf(RowNumber(Nothing) Mod 2, color_a, color_b) on every detail cell's Textbox. Walks the row hierarchy to find the Details leaf — works after add_row_group nests the structure deeper. Replaces any existing BackgroundColor.

ParameterTypeDescription
color_a *stringOdd-row color, e.g. '#F2F2F2'.
color_b *stringEven-row color, e.g. '#FFFFFF'.
path *string
tablix_name *string

set_conditional_row_color

Color every cell of a tablix's detail row based on the value of one of its fields. Builds a Switch(...) expression mapping field values to colors and writes it as BackgroundColor on every detail cell. value_expression is the field reference (e.g. 'Fields!Status.Value' — a leading '=' is accepted). color_map is an ordered dict of value->color (e.g. {"Red":"#FF0000","Yellow":"#FFFF00"}); first match wins. Unmatched values fall back to default_color (default 'Transparent'). When case_sensitive is False (default), wraps the field reference in UCase() and uppercases the keys for case-insensitive…

ParameterTypeDescription
color_map *objectOrdered map of expected values to color strings. First match in declaration order wins.
path *string
tablix_name *string
value_expression *stringField reference to switch on, e.g. 'Fields!Status.Value'. Leading '=' optional.
case_sensitiveboolean
default_colorstring

set_element_visibility

Set <Visibility> on any named ReportItem (Tablix, Textbox, Image, Rectangle, Subreport, Chart). For group-level visibility use set_group_visibility; for detail-row use set_detail_row_visibility. toggle_textbox optionally points at a textbox name that toggles expand/collapse.

ParameterTypeDescription
element_name *string
hidden_expression *string
path *string
toggle_textboxstring | null