Skip to main content
Glama
ethanhan2014

SAP ADT MCP Server

by ethanhan2014

get_class

Fetch ABAP class source code from SAP systems with class name. Optionally specify system ID to choose which system to query. Supports code review, analysis, and automation tasks.

Instructions

Fetch ABAP class source code from SAP system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesClass name (e.g. CL_ABAP_TYPEDESCR)
system_idNoSAP system ID (e.g. DEV). Omit to use default system.

Implementation Reference

  • Handler for the 'get_class' tool: validates input with NameSchema, then calls AdtClient.getSource() with the ADT URI for ABAP classes to fetch the source code.
    case "get_class": {
      const { name: className } = NameSchema.parse(args);
      const source = await client.getSource(
        `/sap/bc/adt/oo/classes/${encodeURIComponent(className.toUpperCase())}/source/main`
      );
      return { content: [{ type: "text", text: source }] };
    }
  • Registration of the 'get_class' tool in the ListToolsRequestSchema handler. Defines name, description, and input schema requiring 'name' with optional system_id.
      name: "get_class",
      description: "Fetch ABAP class source code from SAP system",
      inputSchema: {
        type: "object" as const,
        properties: { name: { type: "string", description: "Class name (e.g. CL_ABAP_TYPEDESCR)" }, ...SYSTEM_ID_PROP },
        required: ["name"],
      },
    },
  • Input validation schema used by get_class: parses the 'name' field as a string.
    const NameSchema = z.object({ name: z.string() });
  • Helper method on AdtClient that performs a GET request with Accept: text/plain and returns the raw source text. Used by the get_class handler.
    async getSource(path: string): Promise<string> {
      const response = await this.http.get<string>(path, {
        headers: { Accept: "text/plain" },
        responseType: "text",
      });
      return response.data;
    }
Behavior3/5

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

Description implies a read-only operation ('fetch') and does not contradict any annotations (none provided). However, it lacks details about side effects, authentication requirements, or what 'source code' precisely entails (e.g., full source, partial).

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?

Single sentence, front-loaded with the key action and resource. No extraneous information.

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 simple fetch tool with two simple parameters and no output schema, the description is mostly complete. It covers the action and the resource. Minor gap: does not specify the format of the returned source code, but the tool name and action are clear enough for an agent.

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?

Input schema has 100% description coverage for both parameters (name and system_id). The description adds no extra meaning beyond what the schema already provides, so it meets the baseline but does not enhance parameter understanding.

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?

Description clearly states verb 'fetch', resource 'ABAP class source code', and context 'from SAP system'. It distinguishes from sibling tools like get_abap_program or get_interface which fetch different ABAP object source codes.

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool over alternatives. While the name suggests it is for class source code, there is no mention of exclusions or comparisons to other get_* tools like get_abap_program or get_function_module.

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/ethanhan2014/sap-adt-mcp'

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