Skip to main content
Glama
DynamicEndpoints

PayPal MCP

create_payout

Send batch payments to multiple recipients through PayPal. Specify recipients, amounts, and payment details to process payouts efficiently.

Instructions

Create a batch payout

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sender_batch_headerYes
itemsYes

Implementation Reference

  • Executes the create_payout tool: validates input with validatePayout, posts to PayPal /v1/payments/payouts API, returns JSON response.
    case 'create_payout': {
      const args = this.validatePayout(request.params.arguments);
      const response = await axios.post<PayPalPayout>(
        'https://api-m.sandbox.paypal.com/v1/payments/payouts',
        args,
        { headers }
      );
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      };
    }
  • Input schema definition for create_payout tool, defining structure for sender_batch_header and items array.
    inputSchema: {
      type: 'object',
      properties: {
        sender_batch_header: {
          type: 'object',
          properties: {
            sender_batch_id: { type: 'string' },
            email_subject: { type: 'string' },
            recipient_type: { type: 'string' }
          },
          required: ['sender_batch_id']
        },
        items: {
          type: 'array',
          items: {
            type: 'object',
            properties: {
              recipient_type: { type: 'string' },
              amount: {
                type: 'object',
                properties: {
                  value: { type: 'string' },
                  currency: { type: 'string' }
                },
                required: ['value', 'currency']
              },
              receiver: { type: 'string' },
              note: { type: 'string' },
              sender_item_id: { type: 'string' }
            },
            required: ['recipient_type', 'amount', 'receiver']
          }
        }
      },
      required: ['sender_batch_header', 'items']
    }
  • src/index.ts:874-913 (registration)
    Tool registration in server.setTools array with name, description, and inputSchema.
    {
      name: 'create_payout',
      description: 'Create a batch payout',
      inputSchema: {
        type: 'object',
        properties: {
          sender_batch_header: {
            type: 'object',
            properties: {
              sender_batch_id: { type: 'string' },
              email_subject: { type: 'string' },
              recipient_type: { type: 'string' }
            },
            required: ['sender_batch_id']
          },
          items: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                recipient_type: { type: 'string' },
                amount: {
                  type: 'object',
                  properties: {
                    value: { type: 'string' },
                    currency: { type: 'string' }
                  },
                  required: ['value', 'currency']
                },
                receiver: { type: 'string' },
                note: { type: 'string' },
                sender_item_id: { type: 'string' }
              },
              required: ['recipient_type', 'amount', 'receiver']
            }
          }
        },
        required: ['sender_batch_header', 'items']
      }
    },
  • Helper method to validate and type-check input arguments for create_payout, ensuring required fields and structure match PayPalPayout.
    private validatePayout(args: unknown): PayPalPayout {
      if (typeof args !== 'object' || !args) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid payout data');
      }
    
      const payout = args as Record<string, unknown>;
      
      if (!payout.sender_batch_header || typeof payout.sender_batch_header !== 'object' ||
          !Array.isArray(payout.items) || payout.items.length === 0) {
        throw new McpError(ErrorCode.InvalidParams, 'Missing required payout fields');
      }
    
      const header = payout.sender_batch_header as Record<string, unknown>;
      if (typeof header.sender_batch_id !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid sender batch ID');
      }
    
      const items = payout.items.map(item => {
        const payoutItem = item as Record<string, unknown>;
        if (typeof payoutItem.recipient_type !== 'string' ||
            !payoutItem.amount || typeof payoutItem.amount !== 'object' ||
            typeof payoutItem.receiver !== 'string') {
          throw new McpError(ErrorCode.InvalidParams, 'Invalid payout item');
        }
    
        const amount = payoutItem.amount as Record<string, unknown>;
        if (typeof amount.value !== 'string' || typeof amount.currency !== 'string') {
          throw new McpError(ErrorCode.InvalidParams, 'Invalid amount fields');
        }
    
        const validatedItem: PayPalPayout['items'][0] = {
          recipient_type: payoutItem.recipient_type,
          amount: {
            value: amount.value,
            currency: amount.currency
          },
          receiver: payoutItem.receiver
        };
    
        if (typeof payoutItem.note === 'string') {
          validatedItem.note = payoutItem.note;
        }
        if (typeof payoutItem.sender_item_id === 'string') {
          validatedItem.sender_item_id = payoutItem.sender_item_id;
        }
    
        return validatedItem;
      });
    
      return {
        sender_batch_header: {
          sender_batch_id: header.sender_batch_id,
          email_subject: typeof header.email_subject === 'string' ? header.email_subject : undefined,
          recipient_type: typeof header.recipient_type === 'string' ? header.recipient_type : undefined
        },
        items
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Create a batch payout' implies a write/mutation operation but doesn't mention critical aspects like required permissions, whether this initiates actual financial transactions, error handling, or what happens on success/failure. For a financial tool with zero annotation coverage, this is a significant gap.

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 extremely concise at just three words, with zero wasted language. It's front-loaded with the core action and resource, making it immediately scannable and efficient.

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?

For a financial transaction tool with 2 complex nested parameters, 0% schema coverage, no annotations, and no output schema, the description is severely inadequate. It doesn't explain what a 'batch payout' entails, what the parameters represent, what happens when invoked, or what to expect in return.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning none of the parameters are documented in the schema. The description doesn't mention any parameters at all, failing to compensate for the complete lack of schema documentation. The agent must infer parameter meanings from property names alone.

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 'Create a batch payout' clearly states the verb ('Create') and resource ('batch payout'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create_referenced_payout' or 'create_payment', which could cause confusion about when to use this specific tool versus alternatives.

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 like 'create_referenced_payout' or 'create_payment'. There's no mention of prerequisites, appropriate contexts, or exclusions, leaving the agent to guess based on tool names alone.

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/Paypal-MCP'

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