Skip to main content
Glama
sap-mcp

sap-mcp

by abap-studio

patch_enho

Replace a uniquely matching code segment in an existing SAP hook Enhancement Implementation, then update and optionally activate without resending the full source; production writes are refused.

Instructions

Modify PART of an existing hook Enhancement Implementation (ENHO/XHH) without resending the whole source. Reads the current source, replaces oldString with newString (must match EXACTLY ONCE), then locks, PUTs, unlocks, and optionally activates. Refuses to run on production profiles. Use this to add/change a single ENHANCEMENT block or a few lines inside one. For BAdI implementations use patch_class on the implementing class.

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": {
      "enhoName": "<enhoName>",
      "oldString": "<oldString>",
      "newString": "<newString>"
    },
    "name": "patch_enho"
  }
}

Input Schema

NameRequiredDescriptionDefault
activateNoActivate after writing. Default false.
enhoNameYesEnhancement implementation name, e.g. ZEH_MY_HOOK
newStringYesReplacement text
oldStringYesExact existing text to replace. Must occur exactly once - include enough context to be unique.
transportNoTransport request. Omit only for local/$TMP objects.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.6/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 burden and does so: it discloses the internals (read source, replace, lock, PUT, unlock, optional activate), the strict precondition that oldString match exactly once, and an environment-level guard against production profiles. These are behaviors an agent cannot get from the schema.

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?

Four sentences, front-loaded with what the tool does, then how it behaves, then when to use it, then the sibling alternative. No filler or restatement of the title.

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?

A no-annotation mutation tool with no output schema needs strong self-description, and this mostly delivers: sequencing, uniqueness precondition, activation default, and production refusal are all covered. Return/error shape and transport-failure behavior are not described, a minor gap given the schema documents transport semantics.

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 the baseline is 3, but the description adds the operational relationship between parameters — that the replace is followed by locking, PUT and optional activation, and that oldString uniqueness is enforced at execution time rather than merely validated. It stops short of describing transport handling for missing values.

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 specific verb and resource ('Modify PART of an existing hook Enhancement Implementation (ENHO/XHH) without resending the whole source') and explicitly marks the boundary against the nearest sibling ('For BAdI implementations use patch_class'). An agent can distinguish this from update_enho or patch_class from the description alone.

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?

Gives a concrete when-to-use rule ('add/change a single ENHANCEMENT block or a few lines inside one') plus an explicit alternative for the BAdI case, and a hard exclusion ('Refuses to run on production profiles'). It does not explain when to prefer the full-source sibling update_enho over patching, which keeps it short of a 5.

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