Skip to main content
Glama
zakblacki

Satim Payment Gateway Integration

by zakblacki

validate_payment_response

Process and verify payment response statuses to ensure accurate order confirmation when integrating with the SATIM payment gateway system.

Instructions

Validate and interpret payment response status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
responseYesOrder confirmation response object

Implementation Reference

  • Executes the validation logic by checking if payment is accepted or rejected using helper methods, determines status (ACCEPTED, REJECTED, ERROR, UNKNOWN), and returns a JSON-formatted response including status, display message, contact info flag, and the original response.
    case "validate_payment_response":
      const response = args.response as OrderConfirmationResponse;
      const isAccepted = SatimPaymentGateway.isPaymentAccepted(response);
      const isRejected = SatimPaymentGateway.isPaymentRejected(response);
      
      let status = "UNKNOWN";
      let displayMessage = "";
      
      if (isAccepted) {
        status = "ACCEPTED";
        displayMessage = response.params?.respCode_desc || response.actionCodeDescription || "Payment accepted";
      } else if (isRejected) {
        status = "REJECTED";
        displayMessage = "Your transaction was rejected / Votre transaction a été rejetée / تم رفض معاملتك";
      } else {
        status = "ERROR";
        displayMessage = response.params?.respCode_desc || response.actionCodeDescription || "Unknown error";
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              status,
              displayMessage,
              shouldShowContactInfo: status === "REJECTED" || status === "ERROR",
              contactNumber: "3020 3020",
              response
            }, null, 2)
          }
        ]
      };
  • Registers the 'validate_payment_response' tool within the MCP server's listTools response, specifying its name, description, and input schema requiring a 'response' object.
    {
      name: "validate_payment_response",
      description: "Validate and interpret payment response status",
      inputSchema: {
        type: "object",
        properties: {
          response: {
            type: "object",
            description: "Order confirmation response object"
          }
        },
        required: ["response"]
      }
    }
  • TypeScript interface defining the expected structure of the OrderConfirmationResponse object passed as input to the validate_payment_response tool.
    interface OrderConfirmationResponse {
      orderNumber?: string;
      actionCode?: number;
      actionCodeDescription?: string;
      amount?: number;
      errorCode?: string;
      errorMessage?: string;
      orderStatus?: number;
      approvalCode?: string;
      authCode?: number;
      cardholderName?: string;
      depositAmount?: number;
      currency?: string;
      pan?: string;
      ip?: string;
      params?: {
        respCode?: string;
        respCode_desc?: string;
        udf1?: string;
        udf2?: string;
        udf3?: string;
        udf4?: string;
        udf5?: string;
      };
    }
  • Static helper methods on the SatimPaymentGateway class that determine if the payment response indicates acceptance (orderStatus === 2) or rejection (orderStatus === 3), used directly in the tool handler.
    static isPaymentAccepted(response: OrderConfirmationResponse): boolean {
      return response.params?.respCode === "00" && 
             response.errorCode === "0" && 
             response.orderStatus === 2;
    }
    
    /**
     * Validate payment rejection status
     */
    static isPaymentRejected(response: OrderConfirmationResponse): boolean {
      return response.params?.respCode === "00" && 
             response.errorCode === "0" && 
             response.orderStatus === 3;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description mentions 'validate and interpret', which implies a read-only analysis, but doesn't specify whether this tool performs any side effects, requires specific permissions, handles errors, or what the output format might be. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 extremely concise with just one sentence: 'Validate and interpret payment response status'. It is front-loaded and wastes no words, making it easy to parse quickly. Every word contributes directly to the purpose statement.

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

Completeness2/5

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

Given the complexity of validating and interpreting payment responses, the description is incomplete. There are no annotations, no output schema, and the description doesn't explain what the tool returns (e.g., validation results, status codes, error messages). For a tool that likely processes critical payment data, more context on behavior and outputs is needed to be fully useful.

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 input schema has 100% description coverage, with the single parameter 'response' documented as 'Order confirmation response object'. The description adds no additional meaning beyond this, as it doesn't explain what constitutes a valid response object or how validation and interpretation are applied. With high schema coverage, the baseline score of 3 is appropriate, but no extra value is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool's purpose as 'validate and interpret payment response status', which is clear but somewhat vague. It specifies the action ('validate and interpret') and the resource ('payment response status'), but doesn't distinguish it from sibling tools like 'confirm_order' or 'refund_order'. The description could be more specific about what validation and interpretation entails.

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?

The description provides no guidance on when to use this tool versus alternatives. There are sibling tools like 'confirm_order' and 'refund_order' that might handle related payment operations, but the description doesn't indicate when this validation tool should be invoked versus those alternatives. No context, exclusions, or prerequisites 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

Related 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/zakblacki/Satim-Payment-Gateway-Integration'

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