Skip to main content
Glama
DynamicEndpoints

Advanced PocketBase MCP Server

create_stripe_payment_intent

Process payments by creating Stripe payment intents for secure transaction handling within PocketBase applications.

Instructions

Create a Stripe payment intent for processing payments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool registration including schema, handler function that validates input, lazy-loads StripeService, calls createPaymentIntent, and returns formatted MCP content response.
    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}`
              })
            }]
          };
        }
      }
    );
  • Core implementation of createPaymentIntent using Stripe SDK: creates payment intent object and returns client secret and ID for frontend confirmation.
    // Create Payment Intent directly (for custom payment flows)
    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}`);
      }
    }
  • Tool schema definition used in Cloudflare Worker tools/list response for MCP protocol discovery.
    {
      name: 'create_stripe_payment_intent',
      description: 'Create a Stripe payment intent for processing payments',
      inputSchema: {
        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']
      }
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool creates a payment intent, implying a write operation, but doesn't disclose critical behaviors: whether this requires authentication, what happens on success/failure, if it's idempotent, or any rate limits. For a payment-related mutation tool with zero annotation coverage, this is a significant gap in transparency.

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: 'Create a Stripe payment intent for processing payments'. It's front-loaded with the core action and resource, with no wasted words. Every part of the sentence adds value, making it highly concise and well-structured for quick understanding.

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 (payment processing is a critical, mutation-heavy domain) and the lack of annotations and output schema, the description is incomplete. It doesn't explain what a payment intent is, what the tool returns, error handling, or security implications. For a Stripe integration tool with no structured support, the description should provide more context to guide safe and effective use.

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 with 100% coverage, meaning no parameters are documented in the schema. The description doesn't mention any parameters, which is appropriate here since none exist. However, it doesn't clarify if parameters are omitted or if the tool operates without inputs, so a perfect score isn't warranted. Baseline 4 applies as it adequately handles the zero-parameter case.

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 tool's purpose: 'Create a Stripe payment intent for processing payments'. It specifies the verb ('Create') and resource ('Stripe payment intent'), and the context ('for processing payments') adds useful specificity. However, it doesn't explicitly differentiate from sibling tools like 'create_stripe_customer' or 'create_stripe_product', which prevents a score of 5.

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 or product first), exclusions, or comparisons to sibling tools like 'create_stripe_customer'. The agent must infer usage from the name alone, which is insufficient for effective tool selection.

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

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