Skip to main content
Glama
ethanhan2014

SAP ADT MCP Server

by ethanhan2014

get_csrf_token

Obtain a CSRF token and session cookie from the SAP system to enable authenticated POST, PUT, or DELETE requests to ADT or other SAP ICF services.

Instructions

Fetch a CSRF token and session cookie from the SAP system. Useful for making authenticated POST/PUT/DELETE requests to ADT or other SAP ICF services.

Input Schema

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

Implementation Reference

  • Tool registration in the ListToolsRequestSchema handler. Defines the 'get_csrf_token' tool with an input schema that only takes the optional system_id property.
    {
      name: "get_csrf_token",
      description: "Fetch a CSRF token and session cookie from the SAP system. Useful for making authenticated POST/PUT/DELETE requests to ADT or other SAP ICF services.",
      inputSchema: {
        type: "object" as const,
        properties: { ...SYSTEM_ID_PROP },
        required: [],
      },
    },
  • Handler in the CallToolRequestSchema switch statement. Calls client.getCsrfToken() and returns the token and session cookie as text.
    case "get_csrf_token": {
      const { token, cookies } = await client.getCsrfToken();
      const text = `CSRF Token: ${token}\nSession Cookie: ${cookies}`;
      return { content: [{ type: "text", text }] };
    }
  • Actual implementation in AdtClient. Calls the private fetchCsrfToken() method to perform an HTTP GET to /sap/bc/adt/discovery with X-CSRF-Token: Fetch header, then returns the stored token and cookie string.
    async getCsrfToken(): Promise<{ token: string; cookies: string }> {
      await this.fetchCsrfToken();
      return { token: this.csrfToken!, cookies: this.getCookieString() };
    }
  • Private helper method that fetches a CSRF token from the SAP ADT discovery endpoint. Stores it in this.csrfToken for later use. Also collects cookies via the axios response interceptor (lines 22-34).
    private async fetchCsrfToken(): Promise<void> {
      const response = await this.http.get("/sap/bc/adt/discovery", {
        headers: { "X-CSRF-Token": "Fetch", Accept: "*/*" },
      });
      const token = response.headers["x-csrf-token"];
      if (!token) throw new Error("Failed to fetch CSRF token");
      this.csrfToken = token;
    }
  • Helper that builds a cookie string from the internal cookieJar, used to return session cookies alongside the CSRF token.
    private getCookieString(): string {
      return Object.entries(this.cookieJar).map(([k, v]) => `${k}=${v}`).join("; ");
    }
Behavior2/5

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

No annotations are provided, so the description must carry the full burden of behavioral disclosure. It mentions fetching a token and cookie but does not disclose whether this creates a session, whether the token has an expiration, or any side effects. For a tool that likely modifies server state (session creation), this is insufficient.

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 sentences long, front-loaded with the core function, and every word adds value. There is no redundancy or fluff.

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 simplicity (one optional parameter, no output schema), the description explains what it returns and its purpose. However, it could mention typical usage patterns (e.g., using the token in Authorization headers) or error scenarios, which would make it more 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?

The only parameter, 'system_id', is fully described in the schema (100% coverage). The description does not add any additional meaning beyond what the schema provides. Baseline score of 3 is appropriate as the schema already does the heavy lifting.

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 uses specific verbs ('Fetch') and nouns ('CSRF token', 'session cookie'), clearly distinguishing the tool from sibling tools like get_abap_program or get_table. It also states the purpose for authenticated POST/PUT/DELETE requests, leaving no ambiguity about what the tool does.

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 the tool is 'Useful for making authenticated POST/PUT/DELETE requests', providing clear context for when to use it. However, it does not specify when not to use it or mention alternatives, which would improve the score further.

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