Skip to main content
Glama

create_gateway

Create a payment gateway for your company by providing a global gateway ID and credential settings. Optionally add a display name, card types, or payment method.

Instructions

Create a company gateway. POST /gateways. Required: gblGatewayId, setting (credentials object). Optional: displayName, card (array of card type IDs), paymentMethod. Use list_global_gateways first to discover valid gblGatewayId and required setting keys (requiredFields / fieldDetails) for each gateway type (e.g. Stripe, Braintree); then build setting with those keys as field names and your credential values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gblGatewayIdYesGlobal gateway ID (required). Obtain from list_global_gateways; use the id as gblGatewayId.
displayNameNoDisplay name for the gateway
settingYesCredentials object (required). Keys must match the gateway's requiredFields from list_global_gateways (e.g. publicKey, privateKey, merchantId, transactionKey). Use fieldDetails for human-readable labels.
cardNoArray of card type IDs (optional)
paymentMethodNoPayment method (optional, may be required by API)

Implementation Reference

  • Handler function that validates args using Zod schema, constructs the request body, and calls the gateway service to create a gateway via POST /gateways.
    async function handler(client: Client, args: Record<string, unknown> | undefined) {
      const parsed = schema.safeParse(args);
      if (!parsed.success) {
        return errorResult(parsed.error.errors.map((e) => e.message).join("; "));
      }
      const body = {
        gblGatewayId: parsed.data.gblGatewayId,
        displayName: parsed.data.displayName,
        setting: parsed.data.setting,
        card: parsed.data.card,
        paymentMethod: parsed.data.paymentMethod,
      };
      return handleToolCall(() => gatewayService.createGateway(client, body));
    }
  • Zod validation schema and MCP ToolDefinition (name, description, inputSchema) for create_gateway. Defines required parameters: gblGatewayId, setting (credentials object), and optional: displayName, card, paymentMethod.
    const settingSchema = z.record(z.union([z.string(), z.number(), z.boolean()]));
    
    const schema = z.object({
      gblGatewayId: z.number().int().positive("gblGatewayId is required"),
      displayName: z.string().optional(),
      setting: settingSchema.refine((obj) => Object.keys(obj).length > 0, "setting must have at least one credential key"),
      card: z.array(z.number().int()).optional(),
      paymentMethod: z.string().optional(),
    });
    
    const definition = {
      name: "create_gateway",
      description:
        "Create a company gateway. POST /gateways. Required: gblGatewayId, setting (credentials object). Optional: displayName, card (array of card type IDs), paymentMethod. Use list_global_gateways first to discover valid gblGatewayId and required setting keys (requiredFields / fieldDetails) for each gateway type (e.g. Stripe, Braintree); then build setting with those keys as field names and your credential values.",
      inputSchema: {
        type: "object" as const,
        properties: {
          gblGatewayId: {
            type: "number",
            description:
              "Global gateway ID (required). Obtain from list_global_gateways; use the id as gblGatewayId.",
          },
          displayName: { type: "string", description: "Display name for the gateway" },
          setting: {
            type: "object",
            description:
              "Credentials object (required). Keys must match the gateway's requiredFields from list_global_gateways (e.g. publicKey, privateKey, merchantId, transactionKey). Use fieldDetails for human-readable labels.",
          },
          card: {
            type: "array",
            description: "Array of card type IDs (optional)",
          },
          paymentMethod: { type: "string", description: "Payment method (optional, may be required by API)" },
        },
        required: ["gblGatewayId", "setting"],
      },
    };
  • Registration of createGatewayTool within the gateways tool collection. Called by the main tools/index.ts registry to include create_gateway in the tool list.
    export function registerGatewayTools(): Tool[] {
      return [
        listGlobalGatewaysTool,
        listGatewaysTool,
        getGatewayTool,
        getClientTokenTool,
        createSetupIntentTool,
        createGatewayTool,
        updateGatewayTool,
        deleteGatewayTool,
        testGatewayTool,
      ];
    }
  • Central tool registry in src/tools/index.ts that spreads all registered tools including createGatewayTool via registerGatewayTools().
    const tools: Tool[] = [
      ...registerCustomerTools(),
      ...registerProductTools(),
      ...registerProductRatePlanTools(),
      ...registerProductRatePlanChargeTools(),
      ...registerSubscriptionTools(),
      ...registerInvoiceTools(),
      ...registerTransactionTools(),
      ...registerBillRunTools(),
      ...registerGatewayTools(),
      ...registerCurrencyTools(),
      ...registerIntegrationTools(),
      ...registerShippingTools(),
      ...registerFilterTools(),
      ...registerDocsTools(),
    ];
    
    /** All tool definitions for tools/list */
    export function getToolDefinitions(): ToolDefinition[] {
      return tools.map((t) => t.definition);
    }
    
    /** Execute a tool by name. Returns result or undefined if tool not found. */
    export async function executeTool(
      name: string,
      args: Record<string, unknown> | undefined,
      client: RebilliaClient
    ): Promise<ToolResult | undefined> {
      const tool = tools.find((t) => t.definition.name === name);
      if (!tool) return undefined;
      return tool.handler(client, args);
    }
  • API service function that performs the actual HTTP POST /gateways call to create a company gateway.
    export async function createGateway(
      client: Client,
      body: CreateGatewayBody
    ): Promise<unknown> {
      return client.post<unknown>("/gateways", body);
    }
Behavior4/5

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

With no annotations, the description fully bears the burden of behavioral disclosure. It explains the creation operation, required parameters, and the need to build the settings object from another tool's output. While it omits details like authorization, idempotency, or side effects, the provided context is substantial and accurate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is somewhat verbose but every sentence contributes value, including the prerequisite workflow and parameter construction guidance. It is well-structured and front-loaded with the core action, though a slight trim could improve conciseness.

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

Completeness5/5

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

Given the 5 parameters, no output schema, and absent annotations, the description fully equips the agent to use the tool correctly. It covers the mandatory parameters, prerequisite steps, and optional fields, making the context complete for a creation tool.

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%, setting a baseline of 3. The description adds significant meaning by detailing how to obtain gblGatewayId from list_global_gateways and how to construct the setting object with keys matching requiredFields, beyond what the schema provides.

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 explicitly states 'Create a company gateway' and references the HTTP method POST. It clearly distinguishes from sibling tools like update_gateway, delete_gateway, list_gateways, and test_gateway, providing specific verb-resource identification.

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 instructs to use list_global_gateways first to discover valid gblGatewayId and required setting keys, providing a clear prerequisite workflow. However, it does not explicitly state when not to use this tool or mention alternatives beyond the prerequisite.

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/rhinosaas/rebillia-mcp-server'

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