Skip to main content
Glama
DynamicEndpoints

pocketbase-mcp-server

create_stripe_payment_intent

Generate a Stripe payment intent to process transactions within PocketBase databases using the MCP server. Facilitates secure and structured payment handling for advanced database operations.

Instructions

Create a Stripe payment intent for processing payments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool registration including schema, handler, and description for 'create_stripe_payment_intent' in the main PocketBaseMCPAgent class.
    this.server.tool(
      'create_stripe_payment_intent',
      'Create a Stripe payment intent for processing payments',
      {
        type: 'object',
        properties: {
          amount: { type: 'number', description: 'Amount in cents (e.g., 2000 for $20.00)' },
          currency: { type: 'string', description: 'Three-letter currency code (e.g., USD)' },
          description: { type: 'string', description: 'Optional description for the payment' }
        },
        required: ['amount', 'currency']
      },
      async ({ amount, currency, description }) => {
        // Lazy load Stripe service
        await this.ensureStripeService();
        
        if (!this.stripeService) {
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                error: 'Stripe service not available. Please set STRIPE_SECRET_KEY environment variable.'
              })
            }]
          };
        }
    
        try {
          const paymentIntent = await this.stripeService.createPaymentIntent({
            amount,
            currency,
            description
          });
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                success: true,
                paymentIntent: {
                  paymentIntentId: paymentIntent.paymentIntentId,
                  clientSecret: paymentIntent.clientSecret
                }
              }, null, 2)
            }]
          };
        } catch (error: any) {
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                error: `Failed to create payment intent: ${error.message}`
              })
            }]
          };
        }
      }
    );
  • The execution handler for the create_stripe_payment_intent tool, which invokes StripeService.createPaymentIntent.
      // Lazy load Stripe service
      await this.ensureStripeService();
      
      if (!this.stripeService) {
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              error: 'Stripe service not available. Please set STRIPE_SECRET_KEY environment variable.'
            })
          }]
        };
      }
    
      try {
        const paymentIntent = await this.stripeService.createPaymentIntent({
          amount,
          currency,
          description
        });
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: true,
              paymentIntent: {
                paymentIntentId: paymentIntent.paymentIntentId,
                clientSecret: paymentIntent.clientSecret
              }
            }, null, 2)
          }]
        };
      } catch (error: any) {
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              error: `Failed to create payment intent: ${error.message}`
            })
          }]
        };
      }
    }
  • JSON Schema defining the input parameters for the create_stripe_payment_intent tool.
    {
      type: 'object',
      properties: {
        amount: { type: 'number', description: 'Amount in cents (e.g., 2000 for $20.00)' },
        currency: { type: 'string', description: 'Three-letter currency code (e.g., USD)' },
        description: { type: 'string', description: 'Optional description for the payment' }
      },
      required: ['amount', 'currency']
    },
  • StripeService.createPaymentIntent helper method that creates the actual Stripe PaymentIntent object and returns clientSecret and ID.
    async createPaymentIntent(data: {
      amount: number;
      currency?: string;
      customerId?: string;
      description?: string;
      metadata?: Record<string, any>;
    }): Promise<{ clientSecret: string; paymentIntentId: string }> {
      try {
        const paymentIntent = await this.stripe.paymentIntents.create({
          amount: data.amount,
          currency: data.currency || 'usd',
          customer: data.customerId,
          description: data.description,
          metadata: data.metadata || {},
        });
    
        return {
          clientSecret: paymentIntent.client_secret!,
          paymentIntentId: paymentIntent.id,
        };
      } catch (error: any) {
        throw new Error(`Failed to create payment intent: ${error.message}`);
      }
    }
Behavior3/5

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

No annotations are provided, so the description carries full burden. 'Create' implies a write operation, but it doesn't disclose behavioral traits like authentication requirements, rate limits, idempotency, or what happens on failure. It adds minimal context beyond the basic action.

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 a single, efficient sentence with zero waste. It's appropriately sized for a simple creation tool and front-loads the core purpose without unnecessary elaboration.

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

Completeness3/5

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

Given no annotations, no output schema, and 0 parameters, the description is minimally complete. It states what the tool does but lacks context about the Stripe integration, expected outcomes, error handling, or dependencies. For a payment processing tool, more detail would be helpful despite the simple parameter structure.

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?

The input schema has 0 parameters (properties object is empty), so there are no parameters to document. The description doesn't need to compensate for any schema gaps. Baseline 4 is appropriate since no parameters exist, though it could theoretically mention implicit requirements not in schema.

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 action ('create') and resource ('Stripe payment intent') with the purpose 'for processing payments'. It distinguishes from siblings like create_stripe_customer or create_stripe_product by specifying the payment intent type. However, it doesn't explicitly differentiate from generic create_record or other payment-related tools that might exist.

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. It doesn't mention prerequisites (e.g., needing a Stripe customer first), when not to use it (e.g., for subscriptions vs one-time payments), or refer to sibling tools like create_stripe_customer that might be needed first.

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/DynamicEndpoints/pocketbase-mcp-server'

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