Skip to main content
Glama

SAPContext

Analyze ABAP object dependencies by extracting compressed public API contracts to understand relationships efficiently before code modifications.

Instructions

Get compressed dependency context for an ABAP object or CDS entity. Returns only the public API contracts (method signatures, interface definitions, type declarations) of all objects that the target depends on — NOT the full source code. This is the most token-efficient way to understand dependencies. Instead of N separate SAPRead calls returning full source (~200 lines each), SAPContext returns ONE response with compressed contracts (~15-30 lines each). Typical compression: 7-30x fewer tokens.

What gets extracted per dependency:

  • Classes: CLASS DEFINITION with PUBLIC SECTION only (methods, types, constants). PROTECTED, PRIVATE and IMPLEMENTATION stripped.

  • Interfaces: Full interface definition (interfaces are already public contracts).

  • Function modules: FUNCTION signature block only (IMPORTING/EXPORTING parameters).

  • CDS views (DDLS): All data sources (tables, other CDS views), association targets, and compositions. Each dependency's full source is included (table definitions, CDS DDL). Essential for CDS unit test generation — provides the dependency graph and field catalogs needed for cl_cds_test_environment doubles.

Filtering: SAP standard objects (CL_ABAP_, IF_ABAP_, CX_SY_) are excluded — the LLM already knows standard SAP APIs. Custom objects (Z, Y*) are prioritized.

Use SAPContext BEFORE writing code that modifies or extends existing objects. Use SAPRead to get the full source of the target object, then SAPContext to understand its dependencies.

For CDS analysis: Use SAPContext instead of reading each view in the dependency chain individually. A single SAPContext call on a consumption view (e.g., ZC_*) returns all dependent interface views, tables, and associations — replacing 5-10 separate SAPRead calls. Only use targeted SAPRead for metadata extensions (DDLX) or service bindings (SRVB) that SAPContext does not cover.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionNoAction: "deps" (default, can be omitted) = get dependency context. "usages" = reverse dependency lookup — find all objects that depend on the given name. Requires cache warmup (--cache-warmup). Only "name" is needed for usages.
typeNoObject type (required for deps action)
nameYesObject name (e.g., ZCL_ORDER)
sourceNoOptional: provide source directly instead of fetching from SAP. Saves one round-trip if you already have the source from SAPRead.
groupNoRequired for FUNC type. The function group containing the function module.
maxDepsNoMaximum dependencies to resolve (default 20). Lower = faster + fewer tokens.
depthNoDependency depth: 1 = direct deps only (default), 2 = deps of deps, 3 = maximum. Higher depth = more context but more SAP calls.
Behavior5/5

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

Since no annotations are provided, the description carries the full burden of behavioral disclosure. It thoroughly explains what the tool does: returns compressed dependency context with specific extraction rules per object type (classes, interfaces, function modules, CDS views), filtering behavior (excludes SAP standard objects, prioritizes custom objects), compression ratios (7-30x fewer tokens), and practical implications for token efficiency. It also covers cache requirements for the 'usages' action.

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?

The description is well-structured with clear sections: purpose, what gets extracted, filtering rules, usage guidelines, and CDS-specific advice. While comprehensive, it's somewhat lengthy (could be more concise). Every sentence adds value, but some information could be more tightly organized. It's front-loaded with the core purpose and key benefits.

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?

Given the tool's complexity (7 parameters, no output schema, no annotations), the description does an excellent job explaining behavior, usage, and benefits. It covers the tool's purpose, what it returns, filtering logic, token efficiency, and detailed usage scenarios. The main gap is the lack of output format details (no output schema provided), but otherwise it's highly complete for a complex dependency analysis tool.

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?

With 100% schema description coverage, the baseline is 3. The description adds meaningful context beyond the schema: it explains the practical implications of 'maxDeps' ('Lower = faster + fewer tokens'), clarifies that 'deps' is the default action (schema says 'default' but not explicitly), and provides real-world examples of parameter values (e.g., 'ZC_*' for name). However, it doesn't fully explain all parameter interactions or edge cases.

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?

The description clearly states the tool's purpose: 'Get compressed dependency context for an ABAP object or CDS entity' with specific details about what it returns (public API contracts only, not full source). It explicitly distinguishes from sibling SAPRead by explaining SAPContext returns compressed contracts while SAPRead returns full source, and mentions other siblings like SAPDiagnose, SAPLint, SAPNavigate, and SAPSearch by implication of being different tools.

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?

The description provides explicit guidance on when to use SAPContext versus alternatives: 'Use SAPContext BEFORE writing code that modifies or extends existing objects. Use SAPRead to get the full source of the target object, then SAPContext to understand its dependencies.' It also gives specific examples for CDS analysis and when to use targeted SAPRead instead. The guidelines clearly differentiate use cases from sibling tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/marianfoo/arc-1'

If you have feedback or need assistance with the MCP directory API, please join our Discord server