Skip to main content
Glama
bw-modeling-mcp

bw-modeling-mcp

by dnic-dev

Create and change queries

bw_write_query
Destructive

Create and modify SAP BW/4HANA queries plus reusable components—layouts, filters, key figures, structures, variables, and role assignments—through defined operations.

Instructions

Create or change a query and its reusable components: layout, filter, key figures, characteristics, cells, exceptions, settings, restricted and calculated key figures, structures, variables, role assignments. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_query", operation: "…") gives the complete parameter definition of one.

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": {
      "operation": "<operation>"
    },
    "name": "bw_write_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
unitNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_variable, update_variable]
actionNo"add" to publish, "remove" to unpublish. [set_roles]
formulaNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_ckf, update_ckf]
membersNoMembers, in display order. [create_structure]
packageNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [5 of 17 operations]
currencyNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_variable, update_variable]
decimalsNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_ckf, update_ckf]
reusableNoWhether the variable can be reused in multiple queries. [create_variable]
copy_fromNoTechnical name of an existing query to copy (e.g. "QUERY_NAME"). [create]
dimensionNoFormula variables only: what the number stands for. [create_variable]
info_areaNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_rkf, create_ckf, create_structure]
iobj_nameNoTechnical name of the InfoObject (characteristic) this variable is based on (e.g. "CHARACTERISTIC"). [create_variable]
operationYesOperation — one of: create: Create a new BW Query (TLOGO ELEM) on an InfoProvider, in package $TMP unless package names another. Requires query_name. | update_layout: Modify an existing BW Query layout: add or remove characteristics in the rows, columns, or free-characteristics area, and add or remove references to reusable… Requires query_name, operations. | update_filter: Modify an existing BW Query filter. Requires query_name, operations. | update_key_figures: Manage the key figure structure and the characteristic structure of an existing BW Query: add basic key figures, add references to reusable CKFs/RKFs (with opt… Requires query_name, operations. | update_characteristic: Set the display and access properties of the characteristics in an existing BW Query - the per-characteristic settings of the rows, columns, and free-character… Requires query_name, characteristics. | update_cells: Manage the cell definitions of an existing BW Query that has two structures (one on each axis): add reference cells (make the value at an intersection of a mem… Requires query_name, operations. | update_exceptions: Manage the exceptions (alert levels that colour data cells) of an existing BW Query: add exceptions with thresholds per alert level, change them, and remove th… Requires query_name, operations. | update_settings: Change query-level display and behaviour settings of an existing BW Query (description, zero suppression, result position, sign presentation, zero presentation… Requires query_name. | create_rkf: Create one reusable Restricted Key Figure (RKF, TLOGO ELEM) on an InfoProvider. Requires provider_name, technical_name, description, base_key_figure, restrictions. | update_rkf: Change a reusable Restricted Key Figure in place: description, base key figure and/or restrictions. Requires component_name. | create_ckf: Create a reusable Calculated Key Figure (CKF) on an InfoProvider. Requires provider_name, technical_name, description, formula. | update_ckf: Change a reusable Calculated Key Figure. Requires component_name. | create_structure: Create a reusable key figure structure on an InfoProvider — the object reporting queries embed as an axis, so that one definition drives all of them. Requires provider_name, technical_name, description. | update_structure: Change a reusable structure: add, remove or re-configure members. Requires component_name, operations. | create_variable: Create a reusable BW Variable, created active and consistent. Requires variable_name, description. | update_variable: Change a reusable BW Variable in place: description, input readiness, input type (optional / mandatory), selection type and processing type, and on a formula v… Requires variable_name. | set_roles: Publish or unpublish a BW query in a role or folder. Requires query_name, action, target_name, target_type.
structureNoStructure the operations address (default "key_figures"). [update_key_figures]
transportNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [9 of 17 operations]
input_typeNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_variable, update_variable]
operationsNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [7 of 17 operations]
query_nameNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [9 of 17 operations]
representsNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_variable, update_variable]
descriptionNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [10 of 17 operations]
target_nameNoFor target_type "role": the name attribute of the ROLE node (e.g. from bw_get_roles). [set_roles]
target_typeNo"role" to assign at role level, "folder" to assign into a specific subfolder. [set_roles]
infoproviderNoTechnical name of the InfoProvider the query is built on (e.g. "PROVIDER_NAME"). [create]
offset_startNoText variables by replacement path only: first character of the value shown, counted from 0 (default 0). [create_variable]
restrictionsNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_rkf, update_rkf]
default_valueNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_variable, update_variable]
offset_lengthNoText variables by replacement path only: number of characters shown; 0 (default) shows the rest. [create_variable]
provider_nameNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_rkf, create_ckf, create_structure]
variable_nameNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_variable, update_variable]
variable_typeNoWhat the variable stands for: a characteristic value (default), a whole hierarchy, hierarchy nodes, a number… [create_variable]
component_nameNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [update_rkf, update_ckf, update_structure]
document_linksNoDocument link visibility. [update_settings]
technical_nameNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_rkf, create_ckf, create_structure]
variable_orderNoOrder of the variables on the variable screen, as technical names (e.g. ["VARIABLE_A", "VARIABLE_B"]). [update_settings]
base_key_figureNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_rkf, update_rkf]
characteristicsNoOne entry per characteristic, or a single entry with infoobject "*" for all of them. [update_characteristic]
master_languageNoLanguage code for the descriptions (e.g. "EN", "DE"). [create_variable]
processing_typeNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_variable, update_variable]
ready_for_inputNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_variable, update_variable]
parent_role_nameNoRequired when target_type is "folder". [set_roles]
replacement_typeNoText variables by replacement path only: what the text shows of the characteristic value — the key (default),… [create_variable]
structure_targetNoContainer for the key figure structure when it is created by the first add operation (default "columns"), and… [update_key_figures]
adjust_formattingNoAdjust formatting. [update_settings]
development_classNoPackage name (e.g. "ZPKG"). [create_variable]
sign_presentationNoWhere the minus sign of a negative value is shown: in front of the number, behind it, or the number in bracke… [update_settings]
transport_requestNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [7 of 17 operations]
planning_new_linesNoOffer new lines on every level of the drilldown. [update_settings]
planning_input_modeNoOpen the query in change mode, so that input-ready cells accept values right away. [update_settings]
result_position_topNoPlace the result row on top. [update_settings]
show_scaling_factorNoShow the scaling factor. [update_settings]
planning_read_postedNoAlways disaggregate to all valid combinations. [update_settings]
replacement_intervalNoText variables by replacement path only: for a range, the lower bound (default), the upper bound, or the diff… [create_variable]
replacement_variableNoText variables by replacement path only: a characteristic value variable on the same characteristic (iobj_nam… [create_variable]
result_position_leftNoPlace the result column on the left. [update_settings]
used_as_infoproviderNoRelease the query as an InfoProvider. [update_settings]
exception_aggregationNoDefined per operation — bw_describe(tool: "bw_write_query", operation: "…") gives each definition. [create_ckf, update_ckf]
zero_suppression_rowsNoSuppress zero-value rows. [update_settings]
hierarchy_display_rowsNoUniversal display hierarchy for rows. [update_settings]
zero_presentation_kindNoHow a zero is shown: with or without its currency or unit, as an empty cell, or as the text in zero_presentat… [update_settings]
zero_suppression_columnsNoSuppress zero-value columns. [update_settings]
hierarchy_display_columnsNoUniversal display hierarchy for columns. [update_settings]
suppress_repeated_key_valuesNoSuppress repeated key values. [update_settings]
zero_presentation_custom_valueNoCustom value shown for zeros. [update_settings]

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv2.2.0
    • changedInput schema / properties / operation / description
      Previous value: -"Operation — one of: create: Create a new BW Query (TLOGO ELEM) on an InfoProvider in package $TMP. Requires query_name. | update_layout: Modify an existing BW Query layout: add or remove characteristics in the rows, columns, or free-characteristics area, and add or remove references to reusable… Requires query_name, operations. | update_filter: Modify an existing BW Query filter. Requires query_name, operations. | update_key_figures: Manage the key figure structure and the characteristic structure of an existing BW Query: add basic key figures, add references to reusable CKFs/RKFs (with opt… Requires query_name, operations. | update_characteristic: Set the display and access properties of the characteristics in an existing BW Query - the per-characteristic settings of the rows, columns, and free-character… Requires query_name, characteristics. | update_cells: Manage the cell definitions of an existing BW Query that has two structures (one on each axis): add reference cells (make the value at an intersection of a mem… Requires query_name, operations. | update_exceptions: Manage the exceptions (alert levels that colour data cells) of an existing BW Query: add exceptions with thresholds per alert level, change them, and remove th… Requires query_name, operations. | update_settings: Change query-level display and behaviour settings of an existing BW Query (description, zero suppression, result position, sign presentation, zero presentation… Requires query_name. | create_rkf: Create one reusable Restricted Key Figure (RKF, TLOGO ELEM) on an InfoProvider. Requires provider_name, technical_name, description, base_key_figure, restrictions. | update_rkf: Change a reusable Restricted Key Figure in place: description, base key figure and/or restrictions. Requires component_name. | create_ckf: Create a reusable Calculated Key Figure (CKF) on an InfoProvider. Requires provider_name, technical_name, description, formula. | update_ckf: Change a reusable Calculated Key Figure. Requires component_name. | create_structure: Create a reusable key figure structure on an InfoProvider — the object reporting queries embed as an axis, so that one definition drives all of them. Requires provider_name, technical_name, description. | update_structure: Change a reusable structure: add, remove or re-configure members. Requires component_name, operations. | create_variable: Create a reusable BW Variable, created active and consistent. Requires variable_name, description. | update_variable: Change a reusable BW Variable in place: description, input readiness, input type (optional / mandatory), selection type and processing type, and on a formula v… Requires variable_name. | set_roles: Publish or unpublish a BW query in a role or folder. Requires query_name, action, target_name, target_type."New value: +"Operation — one of: create: Create a new BW Query (TLOGO ELEM) on an InfoProvider, in package $TMP unless package names another. Requires query_name. | update_layout: Modify an existing BW Query layout: add or remove characteristics in the rows, columns, or free-characteristics area, and add or remove references to reusable… Requires query_name, operations. | update_filter: Modify an existing BW Query filter. Requires query_name, operations. | update_key_figures: Manage the key figure structure and the characteristic structure of an existing BW Query: add basic key figures, add references to reusable CKFs/RKFs (with opt… Requires query_name, operations. | update_characteristic: Set the display and access properties of the characteristics in an existing BW Query - the per-characteristic settings of the rows, columns, and free-character… Requires query_name, characteristics. | update_cells: Manage the cell definitions of an existing BW Query that has two structures (one on each axis): add reference cells (make the value at an intersection of a mem… Requires query_name, operations. | update_exceptions: Manage the exceptions (alert levels that colour data cells) of an existing BW Query: add exceptions with thresholds per alert level, change them, and remove th… Requires query_name, operations. | update_settings: Change query-level display and behaviour settings of an existing BW Query (description, zero suppression, result position, sign presentation, zero presentation… Requires query_name. | create_rkf: Create one reusable Restricted Key Figure (RKF, TLOGO ELEM) on an InfoProvider. Requires provider_name, technical_name, description, base_key_figure, restrictions. | update_rkf: Change a reusable Restricted Key Figure in place: description, base key figure and/or restrictions. Requires component_name. | create_ckf: Create a reusable Calculated Key Figure (CKF) on an InfoProvider. Requires provider_name, technical_name, description, formula. | update_ckf: Change a reusable Calculated Key Figure. Requires component_name. | create_structure: Create a reusable key figure structure on an InfoProvider — the object reporting queries embed as an axis, so that one definition drives all of them. Requires provider_name, technical_name, description. | update_structure: Change a reusable structure: add, remove or re-configure members. Requires component_name, operations. | create_variable: Create a reusable BW Variable, created active and consistent. Requires variable_name, description. | update_variable: Change a reusable BW Variable in place: description, input readiness, input type (optional / mandatory), selection type and processing type, and on a formula v… Requires variable_name. | set_roles: Publish or unpublish a BW query in a role or folder. Requires query_name, action, target_name, target_type."
    • changedInput schema / properties / package / description
      Previous value: -"Defined per operation — bw_describe(tool: \"bw_write_query\", operation: \"…\") gives each definition. [4 of 17 operations]"New value: +"Defined per operation — bw_describe(tool: \"bw_write_query\", operation: \"…\") gives each definition. [5 of 17 operations]"
    • addedInput schema / properties / planning_input_mode
      Added value: +{
      +  "description": "Open the query in change mode, so that input-ready cells accept values right away. [update_settings]",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / planning_new_lines
      Added value: +{
      +  "description": "Offer new lines on every level of the drilldown. [update_settings]",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / planning_read_posted
      Added value: +{
      +  "description": "Always disaggregate to all valid combinations. [update_settings]",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / sign_presentation / description
      Previous value: -"Sign presentation (e.g. \"inFrontOf\", \"after\"). [update_settings]"New value: +"Where the minus sign of a negative value is shown: in front of the number, behind it, or the number in bracke… [update_settings]"
    • addedInput schema / properties / sign_presentation / enum
      Added value: +[
      +  "inFrontOf",
      +  "behind",
      +  "inBrackets"
      +]
    • changedInput schema / properties / transport / description
      Previous value: -"Defined per operation — bw_describe(tool: \"bw_write_query\", operation: \"…\") gives each definition. [8 of 17 operations]"New value: +"Defined per operation — bw_describe(tool: \"bw_write_query\", operation: \"…\") gives each definition. [9 of 17 operations]"
    • addedInput schema / properties / variable_order
      Added value: +{
      +  "description": "Order of the variables on the variable screen, as technical names (e.g. [\"VARIABLE_A\", \"VARIABLE_B\"]). [update_settings]",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / zero_presentation_kind / description
      Previous value: -"Zero presentation kind (e.g. \"withCurrency\"). [update_settings]"New value: +"How a zero is shown: with or without its currency or unit, as an empty cell, or as the text in zero_presentat… [update_settings]"
    • addedInput schema / properties / zero_presentation_kind / enum
      Added value: +[
      +  "withCurrency",
      +  "withoutCurrency",
      +  "asSpace",
      +  "custom"
      +]
  2. Changed9 schema fields changedv2.1.1
    • changedInput schema / properties / copy_from / description
      Previous value: -"Technical name of an existing query to copy (e.g. [create]"New value: +"Technical name of an existing query to copy (e.g. \"QUERY_NAME\"). [create]"
    • changedInput schema / properties / development_class / description
      Previous value: -"Package name (e.g. [create_variable]"New value: +"Package name (e.g. \"ZPKG\"). [create_variable]"
    • changedInput schema / properties / infoprovider / description
      Previous value: -"Technical name of the InfoProvider the query is built on (e.g. [create]"New value: +"Technical name of the InfoProvider the query is built on (e.g. \"PROVIDER_NAME\"). [create]"
    • changedInput schema / properties / iobj_name / description
      Previous value: -"g. [create_variable]"New value: +"Technical name of the InfoObject (characteristic) this variable is based on (e.g. \"CHARACTERISTIC\"). [create_variable]"
    • changedInput schema / properties / master_language / description
      Previous value: -"Language code for the descriptions (e.g. [create_variable]"New value: +"Language code for the descriptions (e.g. \"EN\", \"DE\"). [create_variable]"
    • changedInput schema / properties / replacement_variable / description
      Previous value: -"g. [create_variable]"New value: +"Text variables by replacement path only: a characteristic value variable on the same characteristic (iobj_nam… [create_variable]"
    • changedInput schema / properties / sign_presentation / description
      Previous value: -"Sign presentation (e.g. [update_settings]"New value: +"Sign presentation (e.g. \"inFrontOf\", \"after\"). [update_settings]"
    • changedInput schema / properties / target_name / description
      Previous value: -"For target_type \"role\": the name attribute of the ROLE node (e.g. [set_roles]"New value: +"For target_type \"role\": the name attribute of the ROLE node (e.g. from bw_get_roles). [set_roles]"
    • changedInput schema / properties / zero_presentation_kind / description
      Previous value: -"Zero presentation kind (e.g. [update_settings]"New value: +"Zero presentation kind (e.g. \"withCurrency\"). [update_settings]"
  3. Addedv2.0.0

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false and idempotentHint=false, so the safety profile is known. The description is consistent with that ('change', 'modify an existing') and adds a few behavioral details, notably that created queries land in $TMP unless a package is named and that variables are created active and consistent. It says nothing about irreversibility of updates, transport coupling, or what a caller gets back after a mutation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero filler, and the scope statement is front-loaded before the pointer to the operation enum. The description avoids duplicating the enormous per-operation detail already carried by the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description solves the hardest problem — resolving operation-conditional parameters — but there is no output schema, and the description never says what a successful create or update returns (object name, transport request, warnings). It also omits any caution about the breadth of destructive change this single tool can perform, which matters given 17 mutation operations under one name.

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 baseline would be 3, but the description adds something the schema cannot state at the document level: the 63 parameters are conditional on the operation and must be resolved through bw_describe(tool, operation). For a polymorphic tool of this size that is meaningful navigational guidance rather than restatement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource ("Create or change a query and its reusable components") and enumerates the component families covered — layout, filter, key figures, variables, structures, role assignments — so an agent can tell this apart from read-side siblings like bw_query_data. It does not explicitly name a sibling alternative such as bw_write_planning or bw_write_infosource, which keeps it just short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives a concrete operating procedure: read the operation enum to see what each operation requires, then call bw_describe with the chosen operation for the complete parameter definition. That is real routing guidance and is essential for a 17-operation tool. It stops short of stating when to prefer a different write tool or when not to use this one.

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