Skip to main content
Glama
DynamicEndpoints

PayPal MCP

create_referenced_payout

Create PayPal payouts linked to specific references like orders or invoices, enabling automated payment processing with traceable transaction records.

Instructions

Create a referenced payout

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
referenced_payoutsYes

Implementation Reference

  • Handler implementation in the switch statement that validates arguments, makes POST request to PayPal API for referenced payouts, and returns the response.
    case 'create_referenced_payout': {
      const args = this.validateReferencedPayout(request.params.arguments);
      const response = await axios.post<PayPalReferencedPayout>(
        'https://api-m.sandbox.paypal.com/v1/payments/referenced-payouts',
        args,
        { headers }
      );
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      };
    }
  • src/index.ts:914-942 (registration)
    Tool registration object defining name, description, and input schema for create_referenced_payout.
    {
      name: 'create_referenced_payout',
      description: 'Create a referenced payout',
      inputSchema: {
        type: 'object',
        properties: {
          referenced_payouts: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                reference_id: { type: 'string' },
                reference_type: { type: 'string' },
                payout_amount: {
                  type: 'object',
                  properties: {
                    currency_code: { type: 'string' },
                    value: { type: 'string' }
                  },
                  required: ['currency_code', 'value']
                },
                payout_destination: { type: 'string' }
              },
              required: ['reference_id', 'reference_type', 'payout_amount', 'payout_destination']
            }
          }
        },
        required: ['referenced_payouts']
      }
  • Helper function for validating and formatting input arguments for the create_referenced_payout tool.
    private validateReferencedPayout(args: unknown): PayPalReferencedPayout {
      if (typeof args !== 'object' || !args) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid referenced payout data');
      }
    
      const payout = args as Record<string, unknown>;
      
      if (!Array.isArray(payout.referenced_payouts) || payout.referenced_payouts.length === 0) {
        throw new McpError(ErrorCode.InvalidParams, 'Missing referenced payouts');
      }
    
      const referenced_payouts = payout.referenced_payouts.map(ref => {
        const refPayout = ref as Record<string, unknown>;
        if (typeof refPayout.reference_id !== 'string' ||
            typeof refPayout.reference_type !== 'string' ||
            !refPayout.payout_amount || typeof refPayout.payout_amount !== 'object' ||
            typeof refPayout.payout_destination !== 'string') {
          throw new McpError(ErrorCode.InvalidParams, 'Invalid referenced payout');
        }
    
        const amount = refPayout.payout_amount as Record<string, unknown>;
        if (typeof amount.currency_code !== 'string' || typeof amount.value !== 'string') {
          throw new McpError(ErrorCode.InvalidParams, 'Invalid amount fields');
        }
    
        return {
          item_id: typeof refPayout.item_id === 'string' ? refPayout.item_id : '',
          processing_state: {
            status: typeof refPayout.processing_state === 'object' ? 
              (refPayout.processing_state as any).status || '' : '',
            reason: typeof refPayout.processing_state === 'object' ? 
              (refPayout.processing_state as any).reason : undefined
          },
          reference_id: refPayout.reference_id,
          reference_type: refPayout.reference_type,
          payout_amount: {
            currency_code: amount.currency_code,
            value: amount.value
          },
          payout_destination: refPayout.payout_destination
        };
      });
    
      return { referenced_payouts };
    }
Behavior1/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 but fails completely. It doesn't indicate whether this is a read-only or destructive operation, what permissions might be required, whether it has side effects, rate limits, or what happens upon execution. The single word 'create' suggests a write operation but provides no behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

While technically concise with only three words, this represents under-specification rather than effective brevity. The description fails to provide necessary information that would help an agent understand and use the tool correctly. Every sentence should earn its place, but here the single 'sentence' doesn't earn its place by providing meaningful guidance.

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

Completeness1/5

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

Given the complexity of the input schema (with nested objects for payout amounts), absence of annotations, lack of output schema, and presence of similar sibling tools, the description is completely inadequate. It provides no context about what the tool does, when to use it, what parameters mean, or what behavior to expect - leaving the agent with insufficient information to use this tool effectively.

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

Parameters1/5

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

The schema has 0% description coverage, meaning none of the parameters are documented in the schema itself. The description provides absolutely no information about the 'referenced_payouts' parameter or its complex nested structure. The agent would have no semantic understanding of what data to provide or what 'reference_id', 'reference_type', 'payout_amount', or 'payout_destination' mean.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a referenced payout' is a tautology that essentially restates the tool name without adding meaningful context. It doesn't explain what a 'referenced payout' is, how it differs from the sibling 'create_payout' tool, or what specific action the tool performs beyond the generic 'create' verb.

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

Usage Guidelines1/5

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

The description provides zero guidance about when to use this tool versus alternatives. With sibling tools like 'create_payout' and 'create_payment' available, there's no indication of what distinguishes this tool's purpose or appropriate use cases. No prerequisites, constraints, or comparative context is mentioned.

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