Skip to main content
Glama
DynamicEndpoints

PayPal MCP

create_partner_referral

Generate PayPal partner referral links by providing business details, owner information, and contact email to onboard new merchants.

Instructions

Create a partner referral

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
individual_ownersYes
business_entityYes
emailYes

Implementation Reference

  • Executes the create_partner_referral tool by validating input parameters and sending a POST request to the PayPal partner-referrals API endpoint.
    case 'create_partner_referral': {
      const args = this.validatePartnerReferral(request.params.arguments);
      const response = await axios.post<PayPalPartnerReferral>(
        'https://api-m.sandbox.paypal.com/v2/customer/partner-referrals',
        args,
        { headers }
      );
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      };
    }
  • src/index.ts:977-1021 (registration)
    Registers the create_partner_referral tool with the MCP server, including its name, description, and JSON input schema.
    {
      name: 'create_partner_referral',
      description: 'Create a partner referral',
      inputSchema: {
        type: 'object',
        properties: {
          individual_owners: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                names: {
                  type: 'array',
                  items: {
                    type: 'object',
                    properties: {
                      given_name: { type: 'string' },
                      surname: { type: 'string' }
                    },
                    required: ['given_name', 'surname']
                  }
                }
              },
              required: ['names']
            }
          },
          business_entity: {
            type: 'object',
            properties: {
              business_type: {
                type: 'object',
                properties: {
                  type: { type: 'string' }
                },
                required: ['type']
              },
              business_name: { type: 'string' }
            },
            required: ['business_type', 'business_name']
          },
          email: { type: 'string' }
        },
        required: ['individual_owners', 'business_entity', 'email']
      }
    },
  • TypeScript interface defining the structure expected for PayPal partner referral data.
    interface PayPalPartnerReferral {
      individual_owners: Array<{
        names: Array<{
          prefix?: string;
          given_name: string;
          surname: string;
          middle_name?: string;
          suffix?: string;
        }>;
        citizenship?: string;
        addresses?: Array<{
          address_line_1: string;
          address_line_2?: string;
          admin_area_2: string;
          admin_area_1: string;
          postal_code: string;
          country_code: string;
        }>;
      }>;
      business_entity: {
        business_type: {
          type: string;
          subtype?: string;
        };
        business_name: string;
        business_phone?: {
          country_code: string;
          national_number: string;
        };
      };
      email: string;
    }
  • Validates and sanitizes the input arguments for the create_partner_referral tool according to the expected PayPal API structure.
    private validatePartnerReferral(args: unknown): PayPalPartnerReferral {
      if (typeof args !== 'object' || !args) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid partner referral data');
      }
    
      const referral = args as Record<string, unknown>;
      
      if (!Array.isArray(referral.individual_owners) ||
          !referral.business_entity ||
          typeof referral.email !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Missing required referral fields');
      }
    
      const individual_owners = referral.individual_owners.map(owner => {
        const ownerObj = owner as Record<string, unknown>;
        if (!Array.isArray(ownerObj.names) || ownerObj.names.length === 0) {
          throw new McpError(ErrorCode.InvalidParams, 'Invalid owner names');
        }
    
        const names = ownerObj.names.map(name => {
          const nameObj = name as Record<string, unknown>;
          if (typeof nameObj.given_name !== 'string' || typeof nameObj.surname !== 'string') {
            throw new McpError(ErrorCode.InvalidParams, 'Invalid name fields');
          }
          return {
            given_name: nameObj.given_name,
            surname: nameObj.surname
          };
        });
    
        return { names };
      });
    
      const business = referral.business_entity as Record<string, unknown>;
      if (!business.business_type || typeof business.business_name !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid business entity');
      }
    
      const business_type = business.business_type as Record<string, unknown>;
      if (typeof business_type.type !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid business type');
      }
    
      return {
        individual_owners,
        business_entity: {
          business_type: {
            type: business_type.type
          },
          business_name: business.business_name
        },
        email: referral.email
      };
    }
Behavior1/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but fails completely. 'Create' implies a write/mutation operation, but there's no information about permissions required, side effects, error conditions, rate limits, or what happens after creation. This is inadequate for a tool with complex nested parameters.

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 just three words, this is under-specification rather than effective brevity. The description fails to provide necessary information about a tool with complex parameters and no annotations. Every word should earn its place, but here the words don't provide 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 tool's complexity (3 nested parameters, no annotations, no output schema), the description is completely inadequate. It doesn't explain what the tool does, when to use it, what parameters mean, or what to expect as output. This leaves the agent unable to properly select or invoke this tool.

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?

With 0% schema description coverage and 3 complex nested parameters, the description provides zero information about what individual_owners, business_entity, or email represent. The schema shows these are required objects with specific structures, but the description doesn't even hint at their purpose or relationships.

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 partner referral' is a tautology that restates the tool name without adding meaningful specificity. It doesn't explain what a 'partner referral' is, what resource it creates, or how it differs from sibling tools like create_invoice or create_product. The purpose remains vague despite the clear verb 'Create'.

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 absolutely no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, context, or comparisons to sibling tools like create_referenced_payout or create_web_profile. This leaves the agent with no information about appropriate use cases.

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