Skip to main content
Glama
sap-mcp

sap-mcp

by abap-studio

patch_function_module

Replaces part of an ABAP function module's source by swapping exact old text with new text, locking the function group and optionally activating changes; blocks production writes.

Instructions

Modify PART of an existing ABAP function module. Function-module source lives inside a function group, so it must be locked/written through the fmodules URI - patch_program_source CANNOT do it (SAP rejects locking LU as R3TR PROG). Reads the current source, replaces oldString with newString (must match EXACTLY ONCE), then locks, PUTs, optionally activates, and unlocks. Refuses to run on production profiles. Look up the group first if unsure: SELECT FUNCNAME, PNAME FROM TFDIR - PNAME 'SAPLZFOO' means group 'ZFOO'.

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": {
      "functionGroup": "<functionGroup>",
      "functionModule": "<functionModule>",
      "oldString": "<oldString>",
      "newString": "<newString>"
    },
    "name": "patch_function_module"
  }
}

Input Schema

NameRequiredDescriptionDefault
activateNoActivate after writing. Default false - activate in SE37 yourself.
newStringYesReplacement text
oldStringYesExact existing text to replace. Must occur exactly once - include enough context to be unique.
transportNoTransport request, e.g. D01K903896. Omit only for local/$TMP objects.
functionGroupYesFunction group WITHOUT the SAPL prefix, e.g. ZABLMM_QCF_WF
functionModuleYesFunction module name, e.g. ZABLMM_QCF_WF_APPROVE

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full load and does so well: it discloses the read-modify-write sequence, the exact-once match requirement, the lock/PUT/optional-activate/unlock lifecycle, the production-profile guard, and the transport expectation. These are precisely the operational traits an agent needs before mutating source.

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?

Front-loaded with the core action and the sibling exclusion, then prerequisites and mechanics. Dense but nearly every clause earns its place; the embedded SQL lookup is useful but slightly heavy for a description field.

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 six-parameter mutation tool with no annotations and no output schema, the description covers purpose, prerequisites, safety guard, and execution steps. It does not say what is returned or what happens to the lock if the write or activation fails, which is the remaining gap for a destructive operation.

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 is 3; the description adds real value by explaining that functionGroup must omit the SAPL prefix and how to derive it via SELECT FUNCNAME, PNAME FROM TFDIR. oldString's uniqueness rule and activate's default are also reinforced in prose, though transport handling is only covered by the schema.

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?

States a precise verb and resource ('Modify PART of an existing ABAP function module') and immediately distinguishes itself from the sibling 'patch_program_source', which it says CANNOT do this. The agent can select between the two without opening either schema.

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 names the alternative and why it fails here ('SAP rejects locking L<GROUP>U<nn> as R3TR PROG'), states a precondition (look up the group in TFDIR first, with the SAPL prefix rule), and gives a hard exclusion (refuses on production profiles). When-to-use and when-not-to-use are both covered.

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