Skip to main content
Glama

create_setup_intent

Create a setup intent to securely store payment methods without handling raw card data. Use the returned ID as a nonce to attach a payment method to a customer.

Instructions

Create or retrieve a setup intent via the gateway endpoint. Use only as part of a gateway-agnostic payment method flow: the returned setupIntent.id can be used as paymentMethodNonce for create_customer_payment_method. No raw card data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyGatewayIdYesCompany gateway ID (required).
customerIdYesCustomer ID (required).

Implementation Reference

  • The handler function that parses args (companyGatewayId, customerId) and calls gatewayService.createSetupIntent.
    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 { companyGatewayId, customerId } = parsed.data;
      return handleToolCall(() =>
        gatewayService.createSetupIntent(client, String(companyGatewayId), String(customerId))
      );
    }
  • Zod schema defining required inputs: companyGatewayId (number) and customerId (number).
    const schema = z.object({
      companyGatewayId: z.number({ required_error: "companyGatewayId is required" }),
      customerId: z.number({ required_error: "customerId is required" }),
    });
  • The Tool export object with definition and handler, used for registration elsewhere.
    export const createSetupIntentTool: Tool = {
      definition,
      handler,
    };
  • registerGatewayTools() includes createSetupIntentTool in the list of all gateway tools.
    export function registerGatewayTools(): Tool[] {
      return [
        listGlobalGatewaysTool,
        listGatewaysTool,
        getGatewayTool,
        getClientTokenTool,
        createSetupIntentTool,
        createGatewayTool,
        updateGatewayTool,
        deleteGatewayTool,
        testGatewayTool,
      ];
    }
  • The actual service function that makes the GET /gateways/{companyGatewayId}/customers/{customerId}/setup_intent API call.
    export async function createSetupIntent(
      client: Client,
      companyGatewayId: string,
      customerId: string
    ): Promise<unknown> {
      return client.get<unknown>(
        `/gateways/${encodeURIComponent(companyGatewayId)}/customers/${encodeURIComponent(
          customerId
        )}/setup_intent`
      );
    }
Behavior2/5

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

With no annotations, the description must fully disclose behavior. It mentions 'No raw card data' and the output usage, but fails to detail side effects (e.g., idempotency, whether it creates a new intent each call or retrieves existing) or error conditions. This lack of behavioral detail is a significant gap given the mutation-like nature of the 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?

Two concise sentences with essential information front-loaded. No wasted words; every sentence adds value (purpose, usage, and output hint).

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?

For a two-parameter tool with no output schema, the description provides enough context for basic usage: explains the output (setupIntent.id) and how it fits into a larger flow. However, it lacks details on edge cases and potential errors, which slightly reduces completeness.

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?

Input schema has 100% description coverage, with both parameters (companyGatewayId, customerId) described as 'required'. The description adds no extra meaning beyond the schema, so a baseline score of 3 is appropriate.

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?

Description clearly states it creates or retrieves a setup intent for gateway-agnostic payment method flow. The verb-resource combination is specific, but the 'create or retrieve' phrasing introduces slight ambiguity. It distinguishes itself from sibling tools like create_customer_payment_method by explaining the output usage.

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 provides clear context: 'Use only as part of a gateway-agnostic payment method flow' and explains that the returned ID can be used as paymentMethodNonce. However, it does not explicitly state when not to use this tool or list alternative approaches, leaving room for improvement.

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