Skip to main content
Glama
MCP SAP GUI Server

MCP SAP GUI Server

by kts982

Sap Get Screen Elements

sap_get_screen_elements
Read-only

Discover all elements on the current SAP screen to locate field IDs and filter results by element type or changeable fields.

Instructions

Discover all elements on the current SAP screen.

Useful for finding field IDs when working with a new screen.

Use type_filter and changeable_only to reduce response size on complex screens (e.g. type_filter="GuiTextField,GuiCTextField" to find only input fields).

Trees, ALV grids, text editors and HTML viewers report type GuiShell and a subtype (Tree, GridView, TextEdit, HTMLViewer, Toolbar, ...). type_filter finds them by their class (GuiTree, GuiGridView, ...), by the bare subtype, or all of them by GuiShell. They can sit deep (16 levels were seen): scan from container_id='wnd[0]' with a large max_depth such as 30, together with a type_filter.

max_depth controls how deep to recurse into containers (default 2). Use max_depth=1 for a quick overview, max_depth=3+ for deeply nested layouts (splitter containers, tab strips with sub-containers). When max_depth stopped inside containers that still have children, the response carries depth_limited (also when the result is empty): raise max_depth, or pass one of its examples as container_id.

Pass container_id='wnd[0]/mbar' to discover the menu bar structure.

Radio buttons and checkboxes report selected (true/false); a dropdown reports its selected key.

A table control (SM30-style) is ONE element here, not one per cell: use sap_read_table(columns_only=true) for its columns and cell_id templates. A classic list (report WRITE output, SE16 standard list, F4 hit list) is left out and reported under 'lists': read it with sap_read_list. expand_tables=true lists every visible cell of both (large).

Docking containers sit BESIDE the user area, not inside it: the dialog-structure tree of a view cluster (SM34, most IMG activities) and the SE80 tree are under 'wnd[0]/shellcont'. When the window has any, the response lists them as docking_containers; discover them with that id, or pass container_id='wnd[0]' (max_depth=1) for all top-level areas.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "sap_get_screen_elements"
  }
}

Input Schema

NameRequiredDescriptionDefault
max_depthNo
type_filterNo
container_idNownd[0]/usr
expand_tablesNo
changeable_onlyNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.4.0
    • addedInput schema / properties / expand_tables
      Added value: +{
      +  "default": false,
      +  "type": "boolean"
      +}
  2. First observedv0.2.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations (readOnlyHint=true, destructiveHint=false) are consistent and the description adds substantial behavior the annotations cannot convey: which element types are omitted and reported under 'lists', how GuiShell elements carry subtypes, that docking containers live under 'wnd[0]/shellcont' rather than the user area, that depth_limited is returned even on empty results, and that expand_tables=true produces large responses.

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

Conciseness4/5

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

Purpose and use case are front-loaded, and the remaining paragraphs are task-oriented rather than filler. It is long, though, and max_depth is introduced in a later paragraph than where the parameter is first relevant, which slightly breaks the otherwise clean progression from purpose to filtering to structural caveats.

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

Completeness5/5

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

For a read-only discovery tool with an output schema, this covers everything an agent needs to call it correctly: filtering strategy, depth strategy, the deep-nesting and docking-container traps, containment semantics for table controls and lists, and pointers to the sibling tools to use instead. Return-value detail is appropriately delegated to the schema while key response fields (depth_limited, lists, docking_containers) are still surfaced.

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 0% with five parameters, so the description must carry semantics — and it largely does, covering max_depth (default 2, with tuning recipes), type_filter (accepted names, class vs. subtype vs. GuiShell, with a worked example), container_id (default and specific useful values), and expand_tables (cost warning). changeable_only is only described as a response-size reducer, so its actual meaning (only editable fields) is left for the agent to infer.

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

Purpose5/5

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

Opens with a specific verb and resource: 'Discover all elements on the current SAP screen,' which tells an agent exactly what comes back (screen elements, not data rows or metadata). The follow-up sentence ('Useful for finding field IDs when working with a new screen') pins down the concrete job, and the contrast with sap_read_table / sap_read_list clarifies what this tool is not.

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

Usage Guidelines5/5

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

Explicitly routes away from siblings for the ambiguous cases: a table control is 'ONE element here... use sap_read_table(columns_only=true)', a classic list 'is left out... read it with sap_read_list'. It also gives positive triggers (new screen, menu bar via container_id='wnd[0]/mbar', deep GuiShell containers) and a fallback when depth_limited appears.

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