Skip to main content
Glama

GetServiceBinding

Retrieves source or metadata of an ABAP service binding by name using the ADT Business Services endpoint. Supports XML, JSON, or plain text output.

Instructions

Retrieve ABAP service binding source/metadata by name via ADT Business Services endpoint.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
service_binding_nameYesService binding name (for example: ZUI_MY_BINDING). Case-insensitive.
response_formatNoPreferred response format. "json" requests JSON from endpoint, "xml" parses XML payload, "plain" returns raw text.xml

Implementation Reference

  • The main handler function `handleGetServiceBinding` that retrieves an ABAP service binding by name via ADT Business Services endpoint. It validates input, calls `client.getServiceBinding().read()`, and returns the parsed response.
    export async function handleGetServiceBinding(
      context: HandlerContext,
      args: GetServiceBindingArgs,
    ) {
      const { connection, logger } = context;
    
      try {
        if (!args?.service_binding_name) {
          throw new Error('service_binding_name is required');
        }
    
        const serviceBindingName = args.service_binding_name.trim().toUpperCase();
        const responseFormat = args.response_format ?? 'xml';
        const client = createAdtClient(connection, logger);
        const state = await client.getServiceBinding().read({
          bindingName: serviceBindingName,
        });
        const response = state?.readResult;
        if (!response) {
          throw new Error(
            `Read did not return a response for service binding ${serviceBindingName}`,
          );
        }
    
        return return_response({
          data: JSON.stringify(
            {
              success: true,
              service_binding_name: serviceBindingName,
              response_format: responseFormat,
              status: response.status,
              payload: parseServiceBindingPayload(response.data, responseFormat),
            },
            null,
            2,
          ),
          status: response.status,
          statusText: response.statusText,
          headers: response.headers,
          config: response.config,
        });
      } catch (error: unknown) {
        logger?.error('Error reading service binding:', error);
        return return_error(error);
      }
    }
  • The `TOOL_DEFINITION` constant which defines the tool's name ('GetServiceBinding'), availability, description, and input schema (service_binding_name required, response_format optional with enum of xml/json/plain).
    export const TOOL_DEFINITION = {
      name: 'GetServiceBinding',
      available_in: ['onprem', 'cloud'] as const,
      description:
        'Retrieve ABAP service binding source/metadata by name via ADT Business Services endpoint.',
      inputSchema: {
        type: 'object',
        properties: {
          service_binding_name: {
            type: 'string',
            description:
              'Service binding name (for example: ZUI_MY_BINDING). Case-insensitive.',
          },
          response_format: {
            type: 'string',
            enum: ['xml', 'json', 'plain'],
            description:
              'Preferred response format. "json" requests JSON from endpoint, "xml" parses XML payload, "plain" returns raw text.',
            default: 'xml',
          },
        },
        required: ['service_binding_name'],
      },
    } as const;
  • The `parseServiceBindingPayload` helper function used by the handler to parse the response payload into XML, JSON, or plain text based on the requested format.
    export function parseServiceBindingPayload(
      payload: unknown,
      format: ServiceBindingResponseFormat,
    ): unknown {
      if (format === 'plain') {
        return payload;
      }
    
      if (format === 'json') {
        if (typeof payload === 'string') {
          try {
            return JSON.parse(payload);
          } catch {
            return payload;
          }
        }
        return payload;
      }
    
      if (typeof payload !== 'string') {
        return payload;
      }
    
      const trimmed = payload.trim();
      if (!trimmed.startsWith('<')) {
        return payload;
      }
    
      try {
        const parser = new XMLParser({
          ignoreAttributes: false,
          attributeNamePrefix: '',
        });
        return parser.parse(trimmed);
      } catch {
        return payload;
      }
    }
  • Registration of the GetServiceBinding tool in the HighLevelHandlersGroup, mapping `GetServiceBinding_Tool` definition to the `handleGetServiceBinding` handler with context.
    {
      toolDefinition: GetServiceBinding_Tool,
      handler: withContext(handleGetServiceBinding),
  • Compact router registration mapping the SERVICE_BINDING 'get' route to `handleGetServiceBinding` as a CompactHandler.
    SERVICE_BINDING: {
      create: handleCreateServiceBinding as unknown as CompactHandler,
      get: handleGetServiceBinding as unknown as CompactHandler,
      update: handleUpdateServiceBinding as unknown as CompactHandler,
      delete: handleDeleteServiceBinding as unknown as CompactHandler,
Behavior2/5

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

With no annotations, the description carries full burden. It states 'Retrieve... source/metadata' implying a read operation, but does not disclose error behavior, permission requirements, or what 'source/metadata' entails. This is a minimal disclosure.

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?

The description is a single, 13-word sentence with no redundancy. Every word contributes to the purpose.

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?

While the description covers the basic retrieval action and parameter semantics, it lacks context on what 'metadata' or 'source' includes, potential response behavior, or prerequisites. For a simple retrieval tool, this is adequate but not complete.

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%, yet the description adds value: it notes case-insensitivity for 'service_binding_name' and explains each enum option for 'response_format' beyond the schema's 'Preferred response format'.

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 verb 'Retrieve' and the resource 'ABAP service binding source/metadata', and distinguishes it from sibling tools like GetServiceDefinition by specifying 'via ADT Business Services endpoint'.

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

Usage Guidelines3/5

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

The description implies usage for retrieving service binding details but provides no explicit guidance on when to use this tool vs alternatives like GetServiceDefinition or other getter tools. No exclusions are mentioned.

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