Skip to main content
Glama

Create a pending payment (requires human approval)

grip_create_payment

Stage a USDC payment to a recipient without executing it on-chain. Returns an approval token requiring explicit human confirmation before settlement.

Instructions

Stages a payment from the agent's Grip wallet to a recipient. DOES NOT execute on-chain. Returns an approval_token. You MUST then show the payment details (amount, recipient, memo) to the human in plain language and ASK FOR EXPLICIT CONFIRMATION before calling grip_settle_payment. Never auto-approve. The human must say 'approve' (or equivalent) before settling. If they say 'no', call grip_settle_payment with decision='reject'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipientYes
amount_usdcYes
memoNo

Implementation Reference

  • Registration of the 'grip_create_payment' tool on the MCP server with input schema, title, description, and annotations.
    server.registerTool(
      "grip_create_payment",
      {
        title: "Create a pending payment (requires human approval)",
        description:
          "Stages a payment from the agent's Grip wallet to a recipient. DOES NOT execute on-chain. Returns an approval_token. You MUST then show the payment details (amount, recipient, memo) to the human in plain language and ASK FOR EXPLICIT CONFIRMATION before calling grip_settle_payment. Never auto-approve. The human must say 'approve' (or equivalent) before settling. If they say 'no', call grip_settle_payment with decision='reject'.",
        inputSchema: {
          recipient: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "must be a 0x-prefixed 40-char address"),
          amount_usdc: z.number().positive().max(10000),
          memo: z.string().max(280).optional(),
        },
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: false,
          openWorldHint: false,
        },
      },
      async ({ recipient, amount_usdc, memo }) => {
        if (amount_usdc > PER_TX_CAP) {
          return {
            content: [
              { type: "text", text: `Amount ${amount_usdc} USDC exceeds per-tx cap of ${PER_TX_CAP}. Refusing to stage.` },
            ],
            isError: true,
          };
        }
        const projectedTotal = todaySpent() + amount_usdc;
        if (projectedTotal > DAILY_CAP) {
          return {
            content: [
              { type: "text", text: `Amount ${amount_usdc} USDC would push today's total to ${projectedTotal.toFixed(2)} (daily cap ${DAILY_CAP}). Refusing to stage.` },
            ],
            isError: true,
          };
        }
    
        const token = newToken();
        const payment: PendingPayment = {
          token,
          recipient,
          amountUsdc: amount_usdc,
          memo: memo ?? "",
          createdAt: new Date().toISOString(),
          status: "pending",
        };
        pendingPayments.set(token, payment);
    
        const text = [
          `🟡 Payment STAGED — awaiting human approval.`,
          ``,
          `   Amount:    ${amount_usdc.toFixed(2)} USDC`,
          `   To:        ${recipient}`,
          memo ? `   Memo:      "${memo}"` : null,
          `   Network:   Base mainnet`,
          `   Token:     ${token}`,
          ``,
          `Show these details to the human and ask for explicit approval.`,
          `When they confirm: call grip_settle_payment(approval_token="${token}", decision="approve").`,
          `If they decline: call grip_settle_payment(approval_token="${token}", decision="reject").`,
        ]
          .filter(Boolean)
          .join("\n");
    
        return {
          content: [{ type: "text", text }],
          structuredContent: { token, payment },
        };
      },
    );
  • Handler function for grip_create_payment: validates per-tx cap and daily cap, creates a pending payment with a random token, stores it in the pendingPayments map, and returns the payment details for human approval.
    async ({ recipient, amount_usdc, memo }) => {
      if (amount_usdc > PER_TX_CAP) {
        return {
          content: [
            { type: "text", text: `Amount ${amount_usdc} USDC exceeds per-tx cap of ${PER_TX_CAP}. Refusing to stage.` },
          ],
          isError: true,
        };
      }
      const projectedTotal = todaySpent() + amount_usdc;
      if (projectedTotal > DAILY_CAP) {
        return {
          content: [
            { type: "text", text: `Amount ${amount_usdc} USDC would push today's total to ${projectedTotal.toFixed(2)} (daily cap ${DAILY_CAP}). Refusing to stage.` },
          ],
          isError: true,
        };
      }
    
      const token = newToken();
      const payment: PendingPayment = {
        token,
        recipient,
        amountUsdc: amount_usdc,
        memo: memo ?? "",
        createdAt: new Date().toISOString(),
        status: "pending",
      };
      pendingPayments.set(token, payment);
    
      const text = [
        `🟡 Payment STAGED — awaiting human approval.`,
        ``,
        `   Amount:    ${amount_usdc.toFixed(2)} USDC`,
        `   To:        ${recipient}`,
        memo ? `   Memo:      "${memo}"` : null,
        `   Network:   Base mainnet`,
        `   Token:     ${token}`,
        ``,
        `Show these details to the human and ask for explicit approval.`,
        `When they confirm: call grip_settle_payment(approval_token="${token}", decision="approve").`,
        `If they decline: call grip_settle_payment(approval_token="${token}", decision="reject").`,
      ]
        .filter(Boolean)
        .join("\n");
    
      return {
        content: [{ type: "text", text }],
        structuredContent: { token, payment },
      };
    },
  • Input schema for grip_create_payment: recipient (0x-prefixed ETH address), amount_usdc (positive, max 10000), memo (optional, max 280 chars).
    inputSchema: {
      recipient: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "must be a 0x-prefixed 40-char address"),
      amount_usdc: z.number().positive().max(10000),
      memo: z.string().max(280).optional(),
    },
  • Helper functions todaySpent() and recordSpend() used to enforce the daily spending cap in the handler.
    function todaySpent(): number {
      const today = new Date().toISOString().split("T")[0];
      if (dailySpent.date !== today) {
        dailySpent.date = today;
        dailySpent.total = 0;
      }
      return dailySpent.total;
    }
    
    function recordSpend(amount: number) {
      todaySpent();
      dailySpent.total += amount;
    }
  • newToken() helper that generates a random approval token for each pending payment.
    function newToken(): string {
      return `pay_${randomBytes(6).toString("hex")}`;
    }
Behavior5/5

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

Discloses that the tool does not execute on-chain, returns an approval_token, and requires a two-step human approval process. This adds significant context beyond annotations (which only indicate non-read-only and non-destructive). No contradiction.

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 concise, front-loaded with the core purpose, and structured logically: action, caution, required follow-up steps. Every sentence serves a purpose.

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?

Despite lacking an output schema, the description explains the return value (approval_token) and the complete workflow (stage, confirm, settle/reject). It references sibling tools and provides enough context for a complex, multi-step tool.

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 mentions 'amount, recipient, memo' but does not elaborate on schema constraints like the Ethereum address pattern or USDC amount limits. With 0% schema description coverage, the description adds minimal value over the schema itself.

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 clearly states that this tool stages a payment without executing on-chain, distinguishing it from sibling tools like grip_settle_payment. It specifies the action ('create pending payment') and resource ('agent's Grip wallet to recipient').

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs the agent to never auto-approve, to show payment details to the human, and to ask for explicit confirmation before calling grip_settle_payment. It also covers the rejection case ('If they say 'no', call grip_settle_payment with decision='reject'').

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/grip-foundation/grip-mcp'

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