Skip to main content
Glama
zakblacki

Satim Payment Gateway Integration

by zakblacki

refund_order

Initiate refunds for completed orders by submitting order ID and amount in Algerian Dinars through the Satim Payment Gateway Integration system.

Instructions

Process refund for a completed order

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountInDAYesRefund amount in Algerian Dinars
currencyNoCurrency code012
languageNoLanguage for response messages
orderIdYesOrder ID to refund

Implementation Reference

  • MCP server handler for the 'refund_order' tool: validates gateway configuration, converts input amount to centimes, invokes SatimPaymentGateway.refundOrder, and serializes the response as JSON text content.
    case "refund_order":
      if (!satimGateway) {
        throw new McpError(ErrorCode.InvalidRequest, "Credentials not configured. Use configure_credentials first.");
      }
    
      const refundResponse = await satimGateway.refundOrder({
        orderId: args.orderId as string,
        amount: SatimPaymentGateway.convertAmountToCentimes(args.amountInDA as number),
        currency: args.currency as string,
        language: args.language as 'AR' | 'FR' | 'EN'
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(refundResponse, null, 2)
          }
        ]
      };
  • Registration of the 'refund_order' tool in the MCP listTools response, defining its name, description, and JSON input schema.
    {
      name: "refund_order",
      description: "Process refund for a completed order",
      inputSchema: {
        type: "object",
        properties: {
          orderId: {
            type: "string",
            description: "Order ID to refund"
          },
          amountInDA: {
            type: "number",
            description: "Refund amount in Algerian Dinars"
          },
          currency: {
            type: "string",
            description: "Currency code",
            default: "012"
          },
          language: {
            type: "string",
            enum: ["AR", "FR", "EN"],
            description: "Language for response messages"
          }
        },
        required: ["orderId", "amountInDA"]
      }
    },
  • Core refundOrder method in SatimPaymentGateway class: builds authenticated query parameters and performs HTTP GET to SATIM's refund.do endpoint.
    async refundOrder(params: RefundParams): Promise<RefundResponse> {
      try {
        const queryParams = new URLSearchParams({
          userName: this.credentials.userName,
          password: this.credentials.password,
          orderId: params.orderId,
          amount: params.amount.toString(),
          ...(params.currency && { currency: params.currency }),
          ...(params.language && { language: params.language })
        });
    
        const response = await axios.get(`${this.baseUrl}/refund.do?${queryParams}`);
        return response.data;
      } catch (error) {
        throw new Error(`Refund failed: ${error}`);
      }
    }
  • TypeScript interfaces defining input (RefundParams) and output (RefundResponse) structures for the refund operation.
    interface RefundParams {
      orderId: string;
      amount: number; // Amount in centimes
      currency?: string;
      language?: 'AR' | 'FR' | 'EN';
    }
    
    interface RefundResponse {
      errorCode: number;
      errorMessage?: string;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Process refund' implies a financial mutation, but it doesn't disclose critical traits like required permissions, whether refunds are reversible, rate limits, or what happens if the order isn't completed. This is inadequate for a tool with potential financial impact.

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 perfectly concise at five words, front-loading the core purpose ('Process refund') without any wasted language. Every word earns its place, making it efficient for quick comprehension by an AI agent.

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 tool's complexity (financial mutation with 4 parameters), lack of annotations, and no output schema, the description is insufficient. It doesn't cover behavioral aspects, return values, error conditions, or usage boundaries, leaving the agent with significant uncertainty about how to invoke it correctly.

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 description adds no parameter-specific information beyond what's already in the schema (which has 100% coverage). It doesn't explain relationships between parameters (e.g., how 'amountInDA' relates to 'currency') or provide additional context about parameter usage. The baseline score of 3 reflects adequate but minimal value added.

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

Purpose4/5

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

The description clearly states the verb ('Process refund') and resource ('for a completed order'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling tools like 'confirm_order' or 'register_order' that might also handle order-related operations, which prevents a perfect score.

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 minimal guidance by specifying 'for a completed order', which implies this tool shouldn't be used for pending or cancelled orders. However, it offers no explicit when-to-use rules, alternatives (e.g., vs. 'confirm_order'), or prerequisites, leaving significant gaps in usage context.

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