Skip to main content
Glama

ActivateFunctionGroup

Activates an ABAP function group after creation or update when the object remains inactive.

Instructions

Activate an ABAP function group. Use after CreateFunctionGroup or UpdateFunctionGroup if the object remains inactive.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
function_group_nameYesFunction group name (e.g., Z_FG_TEST).
session_idNoSession ID from GetSession. If not provided, a new session will be created.
session_stateNoSession state from GetSession (cookies, csrf_token, cookie_store). Required if session_id is provided.

Implementation Reference

  • Main handler function for ActivateFunctionGroup MCP tool. Takes a function_group_name, optional session_id/session_state, creates an ADT client, calls activate() on the function group, parses the activation response, and returns success/error info with messages.
    export async function handleActivateFunctionGroup(
      context: HandlerContext,
      args: ActivateFunctionGroupArgs,
    ) {
      const { connection, logger } = context;
      try {
        const { function_group_name, session_id, session_state } =
          args as ActivateFunctionGroupArgs;
    
        // Validation
        if (!function_group_name) {
          return return_error(new Error('function_group_name is required'));
        }
    
        const client = createAdtClient(connection, logger);
        // Restore session state if provided
        if (session_id && session_state) {
          await restoreSessionInConnection(connection, session_id, session_state);
        } else {
          // Ensure connection is established
        }
    
        const functionGroupName = function_group_name.toUpperCase();
    
        logger?.info(`Starting function group activation: ${functionGroupName}`);
    
        try {
          // Activate function group
          const activateState = await client.getFunctionGroup().activate({
            functionGroupName: functionGroupName,
          });
          const response = activateState.activateResult;
    
          if (!response) {
            throw new Error(
              `Activation did not return a response for function group ${functionGroupName}`,
            );
          }
    
          // Parse activation response
          const activationResult = parseActivationResponse(response.data);
          const success = activationResult.activated && activationResult.checked;
    
          // Get updated session state after activation
    
          logger?.info(`✅ ActivateFunctionGroup completed: ${functionGroupName}`);
          logger?.debug(
            `Activated: ${activationResult.activated}, Checked: ${activationResult.checked}, Messages: ${activationResult.messages.length}`,
          );
    
          return return_response({
            data: JSON.stringify(
              {
                success,
                function_group_name: functionGroupName,
                activation: {
                  activated: activationResult.activated,
                  checked: activationResult.checked,
                  generated: activationResult.generated,
                },
                messages: activationResult.messages,
                warnings: activationResult.messages.filter(
                  (m) => m.type === 'warning' || m.type === 'W',
                ),
                errors: activationResult.messages.filter(
                  (m) => m.type === 'error' || m.type === 'E',
                ),
                session_id: session_id || null,
                session_state: null, // Session state management is now handled by auth-broker,
                message: success
                  ? `Function group ${functionGroupName} activated successfully`
                  : `Function group ${functionGroupName} activation completed with ${activationResult.messages.length} message(s)`,
              },
              null,
              2,
            ),
          } as AxiosResponse);
        } catch (error: any) {
          logger?.error(
            `Error activating function group ${functionGroupName}: ${error?.message || error}`,
          );
    
          // Parse error message
          let errorMessage = `Failed to activate function group: ${error.message || String(error)}`;
    
          if (error.response?.status === 404) {
            errorMessage = `Function group ${functionGroupName} not found.`;
          } else if (
            error.response?.data &&
            typeof error.response.data === 'string'
          ) {
            try {
              const { XMLParser } = require('fast-xml-parser');
              const parser = new XMLParser({
                ignoreAttributes: false,
                attributeNamePrefix: '@_',
              });
              const errorData = parser.parse(error.response.data);
              const errorMsg =
                errorData['exc:exception']?.message?.['#text'] ||
                errorData['exc:exception']?.message;
              if (errorMsg) {
                errorMessage = `SAP Error: ${errorMsg}`;
              }
            } catch (_parseError) {
              // Ignore parse errors
            }
          }
    
          return return_error(new Error(errorMessage));
        }
      } catch (error: any) {
        return return_error(error);
      }
    }
  • Low-level tool definition (input schema) for ActivateFunctionGroup. Defines the tool name as 'ActivateFunctionGroupLow' with input parameters including function_group_name (required), session_id (optional), and session_state (optional).
    export const TOOL_DEFINITION = {
      name: 'ActivateFunctionGroupLow',
      available_in: ['onprem', 'cloud', 'legacy'] as const,
      description:
        '[low-level] Activate an ABAP function group. Returns activation status and any warnings/errors. Can use session_id and session_state from GetSession to maintain the same session.',
      inputSchema: {
        type: 'object',
        properties: {
          function_group_name: {
            type: 'string',
            description: 'Function group name (e.g., Z_FG_TEST).',
          },
          session_id: {
            type: 'string',
            description:
              'Session ID from GetSession. If not provided, a new session will be created.',
          },
          session_state: {
            type: 'object',
            description:
              'Session state from GetSession (cookies, csrf_token, cookie_store). Required if session_id is provided.',
            properties: {
              cookies: { type: 'string' },
              csrf_token: { type: 'string' },
              cookie_store: { type: 'object' },
            },
          },
        },
        required: ['function_group_name'],
      },
    } as const;
  • TypeScript interface for ActivateFunctionGroup arguments, mirroring the inputSchema with typed fields for function_group_name, session_id, and session_state.
    interface ActivateFunctionGroupArgs {
      function_group_name: string;
      session_id?: string;
      session_state?: {
        cookies?: string;
        csrf_token?: string;
        cookie_store?: Record<string, string>;
      };
    }
  • Registration of the ActivateFunctionGroup tool within the HighLevelHandlersGroup. The low-level TOOL_DEFINITION is spread (renamed from 'ActivateFunctionGroupLow' to 'ActivateFunctionGroup') and the handler is wrapped with withContext().
    {
      toolDefinition: {
        ...ActivateFunctionGroup_Tool,
        name: 'ActivateFunctionGroup',
        description:
          'Activate an ABAP function group. Use after CreateFunctionGroup or UpdateFunctionGroup if the object remains inactive.',
      },
      handler: withContext(handleActivateFunctionGroup),
    },
  • Import statement bringing in the low-level tool definition (aliased as ActivateFunctionGroup_Tool) and the handleActivateFunctionGroup handler from the implementation file.
    import {
      TOOL_DEFINITION as ActivateFunctionGroup_Tool,
      handleActivateFunctionGroup,
    } from '../../../handlers/function/low/handleActivateFunctionGroup';
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only states 'Activate' without explaining what activation entails (e.g., side effects, permissions, or what happens if already active). This is insufficient for a mutation tool.

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 two short sentences with no unnecessary words. The first sentence states the core function, and the second adds a critical usage context. Perfectly concise.

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 and no annotations, the description covers the basic purpose and usage timing. However, it lacks details on what activation does (e.g., compile, make runtime-ready) and what the response looks like. It is minimally adequate but not complete.

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 the input schema already describes all three parameters. The description does not add extra meaning beyond the schema, which is adequate but not enhancing. Baseline is 3.

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 'Activate' and the resource 'ABAP function group', distinguishing it from siblings like ActivateClass or ActivateTable by specifying it is for function groups. It also provides a usage context: after CreateFunctionGroup or UpdateFunctionGroup if inactive.

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?

The description explicitly states when to use this tool: after CreateFunctionGroup or UpdateFunctionGroup if the object remains inactive. It does not mention when not to use it or provide alternatives, but the context of numerous sibling activation tools implies this is for function groups specifically.

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