Skip to main content
Glama
bw-modeling-mcp

bw-modeling-mcp

by dnic-dev

bw_create_variable

Create reusable BW variables for SAP BW/4HANA queries to filter or parameterize data. Supports characteristic, formula, and text types.

Instructions

Create a reusable BW Variable, created active and consistent. A characteristic variable (the default) is a filter parameter on a characteristic: processing types UserEntry (manual entry, the default), CustomerExit, Authorization and the current-member flavour of ReplacementPath; it stands for a characteristic value, a hierarchy or hierarchy nodes. A formula variable (variable_type "Formula") stands for a number and is used as a formula operand in bw_update_query_key_figures, bw_create_ckf and bw_update_ckf: no iobj_name, filled by UserEntry or CustomerExit, with a dimension, an optional default value, and a unit (Quantity), a currency (Amount) or either (Price). A text variable (variable_type "Text") is written as &NAME& into a query or member description and replaced at runtime: by replacement path (the default with iobj_name) it shows the key, the external key or the text of that characteristic's value and is never ready for input; filled by CustomerExit or UserEntry it takes no iobj_name. The query tools bind a text variable named in a description when they save the query. To keep a variable out of the user's variable screen, set ready_for_input false.

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": {
      "variable_name": "<variable_name>",
      "description": "<description>"
    },
    "name": "bw_create_variable"
  }
}

Input Schema

NameRequiredDescriptionDefault
unitNoFormula variables only: unit of measure. Required for dimension Quantity (a query cannot be generated without it), optional for Price.
packageNoAlias for development_class (for consistency with other tools).
currencyNoFormula variables only: currency key. Required for dimension Amount, optional for Price.
reusableNoWhether the variable can be reused in multiple queries. Defaults to true.
dimensionNoFormula variables only: what the number stands for. Defaults to Number.
iobj_nameNoTechnical name of the InfoObject (characteristic) this variable is based on (e.g. "CHARACTERISTIC"). Must exist in the system. Required for a characteristic variable and for a text variable by replacement path (the characteristic whose value it shows); leave it out for a formula variable and for a text variable filled by CustomerExit or UserEntry.
transportNoTransport request number (e.g. "DEVK900123"). Only needed when the target package is transportable.
input_typeNoWhether a value is required: Optional (default), MandatoryWithInitial (entry required, initial value allowed) or MandatoryWithoutInitial (entry required, initial value rejected).
representsNoSelection type. Interval is a from/to range, SelectionOption allows the full set of comparison operators. Defaults to Interval.
descriptionYesVariable description (displayed in query parameter screens).
offset_startNoText variables by replacement path only: first character of the value shown, counted from 0 (default 0).
default_valueNoFormula variables only: the value proposed on the variable screen. BW parses it in the logon user's decimal notation, so a fractional value needs read access to that setting (USR01 through ADT DataPreview); without it only whole numbers are accepted.
offset_lengthNoText variables by replacement path only: number of characters shown; 0 (default) shows the rest.
variable_nameYesTechnical name of the variable to create (e.g. "VAR_NAME").
variable_typeNoWhat the variable stands for: a characteristic value (default), a whole hierarchy, hierarchy nodes, a number (Formula) or a text (Text). Hierarchy variables still reference a characteristic via iobj_name; formula and text variables always represent a single value.
master_languageNoLanguage code for the descriptions (e.g. "EN", "DE"). Defaults to the BW_LANGUAGE of the connection, otherwise "EN".
processing_typeNoHow the variable is filled: UserEntry (manual entry by the user, the default), CustomerExit (filled by the exit), Authorization, or ReplacementPath. Replacement path is limited to the current-member variant, which needs no donor object; replacement from a query result is not supported.
ready_for_inputNoWhether the variable is shown on the variable screen for user input. Defaults to true, for a text variable only with UserEntry. Set false for a variable that only the customer exit fills. A text variable by replacement path cannot be ready for input.
replacement_typeNoText variables by replacement path only: what the text shows of the characteristic value — the key (default), the external key, or its text (Name).
development_classNoPackage name (e.g. "ZPKG"). Defaults to $TMP if omitted.
replacement_intervalNoText variables by replacement path only: for a range, the lower bound (default), the upper bound, or the difference.
replacement_variableNoText variables by replacement path only: a characteristic value variable on the same characteristic (iobj_name) to read the value from, instead of the characteristic itself (e.g. "VAR_NAME").

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed14 schema fields changedv1.8.1
    • addedInput schema / properties / currency
      Added value: +{
      +  "description": "Formula variables only: currency key. Required for dimension Amount, optional for Price.",
      +  "type": "string"
      +}
    • addedInput schema / properties / default_value
      Added value: +{
      +  "description": "Formula variables only: the value proposed on the variable screen. BW parses it in the logon user's decimal notation, so a fractional value needs read access to that setting (USR01 through ADT DataPreview); without it only whole numbers are accepted.",
      +  "type": "number"
      +}
    • addedInput schema / properties / dimension
      Added value: +{
      +  "description": "Formula variables only: what the number stands for. Defaults to Number.",
      +  "enum": [
      +    "Number",
      +    "Amount",
      +    "Quantity",
      +    "Price",
      +    "Quota",
      +    "Date",
      +    "Time"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / iobj_name / description
      Previous value: -"Technical name of the InfoObject (characteristic) this variable is based on (e.g. \"0CALMONTH\"). Must exist in the system."New value: +"Technical name of the InfoObject (characteristic) this variable is based on (e.g. \"CHARACTERISTIC\"). Must exist in the system. Required for a characteristic variable and for a text variable by replacement path (the characteristic whose value it shows); leave it out for a formula variable and for a text variable filled by CustomerExit or UserEntry."
    • addedInput schema / properties / offset_length
      Added value: +{
      +  "description": "Text variables by replacement path only: number of characters shown; 0 (default) shows the rest.",
      +  "type": "number"
      +}
    • addedInput schema / properties / offset_start
      Added value: +{
      +  "description": "Text variables by replacement path only: first character of the value shown, counted from 0 (default 0).",
      +  "type": "number"
      +}
    • changedInput schema / properties / ready_for_input / description
      Previous value: -"Whether the variable is shown on the variable screen for user input. Defaults to true. Set false for a variable that only the customer exit fills."New value: +"Whether the variable is shown on the variable screen for user input. Defaults to true, for a text variable only with UserEntry. Set false for a variable that only the customer exit fills. A text variable by replacement path cannot be ready for input."
    • addedInput schema / properties / replacement_interval
      Added value: +{
      +  "description": "Text variables by replacement path only: for a range, the lower bound (default), the upper bound, or the difference.",
      +  "enum": [
      +    "FromValue",
      +    "ToValue",
      +    "Difference"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / replacement_type
      Added value: +{
      +  "description": "Text variables by replacement path only: what the text shows of the characteristic value — the key (default), the external key, or its text (Name).",
      +  "enum": [
      +    "Key",
      +    "ExternalCharacteristic",
      +    "Name"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / replacement_variable
      Added value: +{
      +  "description": "Text variables by replacement path only: a characteristic value variable on the same characteristic (iobj_name) to read the value from, instead of the characteristic itself (e.g. \"VAR_NAME\").",
      +  "type": "string"
      +}
    • addedInput schema / properties / unit
      Added value: +{
      +  "description": "Formula variables only: unit of measure. Required for dimension Quantity (a query cannot be generated without it), optional for Price.",
      +  "type": "string"
      +}
    • changedInput schema / properties / variable_type / description
      Previous value: -"What the variable stands for: a characteristic value (default), a whole hierarchy, or hierarchy nodes. Hierarchy variables still reference a characteristic via iobj_name."New value: +"What the variable stands for: a characteristic value (default), a whole hierarchy, hierarchy nodes, a number (Formula) or a text (Text). Hierarchy variables still reference a characteristic via iobj_name; formula and text variables always represent a single value."
    • changedInput schema / properties / variable_type / enum
      Previous value: -[
      -  "CharacteristicValue",
      -  "Hierarchy",
      -  "HierarchyNodes"
      -]New value: +[
      +  "CharacteristicValue",
      +  "Hierarchy",
      +  "HierarchyNodes",
      +  "Formula",
      +  "Text"
      +]
    • changedInput schema / required
      Previous value: -[
      -  "variable_name",
      -  "iobj_name",
      -  "description"
      -]New value: +[
      +  "variable_name",
      +  "description"
      +]
  2. Addedv1.4.0

TDQS

A3.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and mostly delivers: it discloses the non-obvious trait that the variable is 'created active and consistent', explains ready_for_input interactions with the user variable screen, the ReplacementPath limitation, and even the default_value decimal-notation permission caveat (USR01 via ADT DataPreview). It stops short of covering prerequisites like transport, locking, or error/rollback behavior.

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

Conciseness3/5

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

Front-loaded correctly with the core purpose, and nearly every sentence carries substantive detail. But it is presented as one dense, comma-laden block of run-on sentences with heavy parenthetical nesting, which hurts scanability for such a complex parameter space.

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

Completeness4/5

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

For a 22-parameter creation tool with no annotations and no output schema, the description plus the exhaustive schema give an agent enough to invoke it correctly across the main variable types. Missing only lifecycle/workflow context (transport handling, activation, locks) that a create operation would benefit from.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3 and the schema already documents all 22 parameters including per-type applicability. The description adds some cross-parameter logic (which type needs iobj_name, what makes a formula vs text variable), but this largely duplicates what the individual schema descriptions already state.

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?

States a specific verb and resource ('Create a reusable BW Variable') and goes further by enumerating the five variable types and what each stands for, so an agent knows exactly what is being produced. It names consuming siblings (bw_update_query_key_figures, bw_create_ckf, bw_update_ckf) for formula variables, but never explicitly contrasts create against the sibling bw_update_variable/bw_get_variable, leaving that distinction implicit.

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

Usage Guidelines3/5

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

Rich selection guidance for which variable_type to choose and how it feeds downstream tools, and it flags a hard constraint ('replacement from a query result is not supported'). However there is no explicit when-to-use-this-over-alternatives statement (e.g. create vs update_variable), so usage is implied rather than stated.

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

Deploy Server

Other Tools