Skip to main content
Glama

GetAbapSystemSymbols

Resolve ABAP symbols from source code to obtain types, scopes, descriptions, and package information for semantic analysis.

Instructions

[read-only] Resolve ABAP symbols from semantic analysis with SAP system information including types, scopes, descriptions, and packages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesABAP source code to analyze and resolve symbols for
filePathNoOptional file path to write the result to

Implementation Reference

  • Main handler function that executes the GetAbapSystemSymbols tool logic. Performs semantic analysis on ABAP code using SimpleAbapSemanticAnalyzer, then resolves symbols with SAP system info using AbapSystemSymbolResolver. Returns symbols with system metadata and resolution statistics.
    export async function handleGetAbapSystemSymbols(
      context: HandlerContext,
      args: any,
    ) {
      const { logger } = context;
      try {
        if (!args?.code) {
          throw new McpError(ErrorCode.InvalidParams, 'ABAP code is required');
        }
        logger?.debug('Running semantic analysis and system symbol resolution');
    
        // First, perform semantic analysis
        const analyzer = new SimpleAbapSemanticAnalyzer();
        const semanticResult = analyzer.analyze(args.code);
    
        // Then, resolve symbols with SAP system information
        const resolver = new AbapSystemSymbolResolver();
        const { resolvedSymbols, stats } = await resolver.resolveSymbols(
          context,
          semanticResult.symbols,
        );
        logger?.info(
          `Resolved ${stats.resolvedSymbols}/${stats.totalSymbols} symbols from system`,
        );
    
        const result: AbapSystemSymbolsResult = {
          symbols: resolvedSymbols,
          dependencies: semanticResult.dependencies,
          errors: semanticResult.errors,
          scopes: semanticResult.scopes,
          systemResolutionStats: stats,
        };
    
        const response = {
          isError: false,
          content: [
            {
              type: 'json',
              json: result,
            },
          ],
        };
    
        if (args.filePath) {
          logger?.debug(
            `Writing system symbol resolution result to file: ${args.filePath}`,
          );
          writeResultToFile(JSON.stringify(result, null, 2), args.filePath);
        }
    
        return response;
      } catch (error) {
        logger?.error('Failed to resolve ABAP system symbols', error as any);
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: error instanceof Error ? error.message : String(error),
            },
          ],
        };
      }
    }
  • Tool definition/schema for GetAbapSystemSymbols. Defines the tool name, description, availability (onprem + cloud), and inputSchema requiring 'code' (ABAP source string) with optional 'filePath' for writing results.
    export const TOOL_DEFINITION = {
      name: 'GetAbapSystemSymbols',
      available_in: ['onprem', 'cloud'] as const,
      description:
        '[read-only] Resolve ABAP symbols from semantic analysis with SAP system information including types, scopes, descriptions, and packages.',
      inputSchema: {
        type: 'object',
        properties: {
          code: {
            type: 'string',
            description: 'ABAP source code to analyze and resolve symbols for',
          },
          filePath: {
            type: 'string',
            description: 'Optional file path to write the result to',
          },
        },
        required: ['code'],
      },
    } as const;
  • Import of the TOOL_DEFINITION and handler from the implementation file into the SystemHandlersGroup.
    import {
      TOOL_DEFINITION as GetAbapSystemSymbols_Tool,
      handleGetAbapSystemSymbols,
    } from '../../../handlers/system/readonly/handleGetAbapSystemSymbols';
  • Registration of GetAbapSystemSymbols tool with its definition and handler in the SystemHandlersGroup tool map.
    {
      toolDefinition: GetAbapSystemSymbols_Tool,
      handler: (args: any) => handleGetAbapSystemSymbols(this.context, args),
    },
  • SimpleAbapSemanticAnalyzer class that parses ABAP source code to extract symbols (classes, methods, variables, constants, types, forms, functions, includes, interfaces), scopes, dependencies, and errors from textual analysis.
    class SimpleAbapSemanticAnalyzer {
      private symbols: AbapSymbolInfo[] = [];
      private scopes: AbapScopeInfo[] = [];
      private dependencies: string[] = [];
      private errors: AbapParseError[] = [];
      private currentScope: string = 'global';
    
      public analyze(code: string): {
        symbols: AbapSymbolInfo[];
        dependencies: string[];
        errors: AbapParseError[];
        scopes: AbapScopeInfo[];
      } {
        // Reset state
        this.symbols = [];
        this.scopes = [];
        this.dependencies = [];
        this.errors = [];
        this.currentScope = 'global';
    
        try {
          this.analyzeCode(code);
        } catch (error) {
          this.errors.push({
            message: error instanceof Error ? error.message : String(error),
            line: 1,
            column: 1,
            severity: 'error',
          });
        }
    
        return {
          symbols: this.symbols,
          dependencies: this.dependencies,
          errors: this.errors,
          scopes: this.scopes,
        };
      }
    
      private analyzeCode(code: string): void {
Behavior2/5

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

The description indicates read-only behavior with '[read-only]', but lacks details on error handling, authentication needs, or what happens on invalid input. Without annotations, the description carries full burden and falls short.

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 '[read-only]', and efficiently conveys core purpose. No redundant phrases.

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

Completeness3/5

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

Given no output schema, the description partially compensates by listing expected output fields (types, scopes, etc.). However, it doesn't explain how results differ from sibling analysis tools or cover edge cases.

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?

Schema description coverage is 100%, so baseline is 3. The description does not add meaningful context beyond the schema; it merely rephrases the parameter descriptions without deeper semantics.

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 'Resolve ABAP symbols from semantic analysis' with specific details about included information (types, scopes, descriptions, packages). This distinguishes it from sibling tools focused on specific object types or actions (e.g., GetClass, CreateTable).

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 guidance on when to use this tool versus siblings like GetAbapAST or GetAbapSemanticAnalysis, which are semantically similar. The description doesn't mention prerequisites, alternatives, or exclusion criteria.

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/fr0ster/mcp-abap-adt'

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