Skip to main content
Glama
DynamicEndpoints

PayPal MCP

create_product

Create new products in PayPal by specifying name, description, type, and category to manage your inventory.

Instructions

Create a new product in PayPal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
descriptionYes
typeYes
categoryYes
image_urlNo
home_urlNo

Implementation Reference

  • The main handler for the 'create_product' tool. Validates input using validatePayPalProduct, makes a POST request to PayPal's catalog products API, and returns the response.
    case 'create_product': {
      const args = this.validatePayPalProduct(request.params.arguments);
      const response = await axios.post<PayPalResponse>(
        'https://api-m.sandbox.paypal.com/v1/catalogs/products',
        args,
        { headers }
      );
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      };
    }
  • The input schema definition for the 'create_product' tool, registered in the tools list for ListToolsRequest.
    {
      name: 'create_product',
      description: 'Create a new product in PayPal',
      inputSchema: {
        type: 'object',
        properties: {
          name: { type: 'string' },
          description: { type: 'string' },
          type: { 
            type: 'string',
            enum: ['PHYSICAL', 'DIGITAL', 'SERVICE']
          },
          category: { type: 'string' },
          image_url: { type: 'string' },
          home_url: { type: 'string' }
        },
        required: ['name', 'description', 'type', 'category']
      }
  • Helper method that validates and sanitizes the input arguments for the create_product tool, ensuring required fields and types match the schema.
    private validatePayPalProduct(args: unknown): PayPalProduct {
      if (typeof args !== 'object' || !args) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid product data');
      }
    
      const product = args as Record<string, unknown>;
      
      if (typeof product.name !== 'string' ||
          typeof product.description !== 'string' ||
          !['PHYSICAL', 'DIGITAL', 'SERVICE'].includes(product.type as string) ||
          typeof product.category !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Missing required product fields');
      }
    
      const validatedProduct: PayPalProduct = {
        name: product.name,
        description: product.description,
        type: product.type as 'PHYSICAL' | 'DIGITAL' | 'SERVICE',
        category: product.category,
      };
    
      if (typeof product.image_url === 'string') {
        validatedProduct.image_url = product.image_url;
      }
      if (typeof product.home_url === 'string') {
        validatedProduct.home_url = product.home_url;
      }
    
      return validatedProduct;
    }
  • src/index.ts:777-1139 (registration)
    The tool is registered by including its definition in the tools array returned by the ListToolsRequest handler in setupToolHandlers method.
    private setupToolHandlers() {
      this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [
          {
            name: 'create_payment_token',
            description: 'Create a payment token',
            inputSchema: {
              type: 'object',
              properties: {
                customer: {
                  type: 'object',
                  properties: {
                    id: { type: 'string' },
                    email_address: { type: 'string' }
                  },
                  required: ['id']
                },
                payment_source: {
                  type: 'object',
                  properties: {
                    card: {
                      type: 'object',
                      properties: {
                        name: { type: 'string' },
                        number: { type: 'string' },
                        expiry: { type: 'string' },
                        security_code: { type: 'string' }
                      }
                    },
                    paypal: {
                      type: 'object',
                      properties: {
                        email_address: { type: 'string' }
                      }
                    }
                  }
                }
              },
              required: ['customer', 'payment_source']
            }
          },
          {
            name: 'create_payment',
            description: 'Create a payment',
            inputSchema: {
              type: 'object',
              properties: {
                intent: { type: 'string' },
                payer: {
                  type: 'object',
                  properties: {
                    payment_method: { type: 'string' },
                    funding_instruments: {
                      type: 'array',
                      items: {
                        type: 'object',
                        properties: {
                          credit_card: {
                            type: 'object',
                            properties: {
                              number: { type: 'string' },
                              type: { type: 'string' },
                              expire_month: { type: 'number' },
                              expire_year: { type: 'number' },
                              cvv2: { type: 'string' },
                              first_name: { type: 'string' },
                              last_name: { type: 'string' }
                            }
                          }
                        }
                      }
                    }
                  },
                  required: ['payment_method']
                },
                transactions: {
                  type: 'array',
                  items: {
                    type: 'object',
                    properties: {
                      amount: {
                        type: 'object',
                        properties: {
                          total: { type: 'string' },
                          currency: { type: 'string' }
                        },
                        required: ['total', 'currency']
                      },
                      description: { type: 'string' }
                    },
                    required: ['amount']
                  }
                }
              },
              required: ['intent', 'payer', 'transactions']
            }
          },
          {
            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']
            }
          },
          {
            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']
            }
          },
          {
            name: 'create_order',
            description: 'Create a new order in PayPal',
            inputSchema: {
              type: 'object',
              properties: {
                intent: { 
                  type: 'string',
                  enum: ['CAPTURE', 'AUTHORIZE']
                },
                purchase_units: {
                  type: 'array',
                  items: {
                    type: 'object',
                    properties: {
                      amount: {
                        type: 'object',
                        properties: {
                          currency_code: { type: 'string' },
                          value: { type: 'string' }
                        },
                        required: ['currency_code', 'value']
                      },
                      description: { type: 'string' },
                      reference_id: { type: 'string' }
                    },
                    required: ['amount']
                  }
                }
              },
              required: ['intent', 'purchase_units']
            }
          },
          {
            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']
            }
          },
          {
            name: 'create_web_profile',
            description: 'Create a web experience profile',
            inputSchema: {
              type: 'object',
              properties: {
                name: { type: 'string' },
                presentation: {
                  type: 'object',
                  properties: {
                    brand_name: { type: 'string' },
                    logo_image: { type: 'string' },
                    locale_code: { type: 'string' }
                  }
                },
                input_fields: {
                  type: 'object',
                  properties: {
                    no_shipping: { type: 'number' },
                    address_override: { type: 'number' }
                  }
                },
                flow_config: {
                  type: 'object',
                  properties: {
                    landing_page_type: { type: 'string' },
                    bank_txn_pending_url: { type: 'string' }
                  }
                }
              },
              required: ['name']
            }
          },
          {
            name: 'create_product',
            description: 'Create a new product in PayPal',
            inputSchema: {
              type: 'object',
              properties: {
                name: { type: 'string' },
                description: { type: 'string' },
                type: { 
                  type: 'string',
                  enum: ['PHYSICAL', 'DIGITAL', 'SERVICE']
                },
                category: { type: 'string' },
                image_url: { type: 'string' },
                home_url: { type: 'string' }
              },
              required: ['name', 'description', 'type', 'category']
            }
          },
          {
            name: 'list_products',
            description: 'List all products',
            inputSchema: {
              type: 'object',
              properties: {
                page_size: { type: 'number', minimum: 1, maximum: 100 },
                page: { type: 'number', minimum: 1 }
              }
            }
          },
          {
            name: 'get_dispute',
            description: 'Get details of a dispute',
            inputSchema: {
              type: 'object',
              properties: {
                dispute_id: { type: 'string' }
              },
              required: ['dispute_id']
            }
          },
          {
            name: 'get_userinfo',
            description: 'Get user info from identity token',
            inputSchema: {
              type: 'object',
              properties: {
                access_token: { type: 'string' }
              },
              required: ['access_token']
            }
          },
          {
            name: 'create_invoice',
            description: 'Create a new invoice',
            inputSchema: {
              type: 'object',
              properties: {
                invoice_number: { type: 'string' },
                reference: { type: 'string' },
                currency_code: { type: 'string' },
                recipient_email: { type: 'string' },
                items: {
                  type: 'array',
                  items: {
                    type: 'object',
                    properties: {
                      name: { type: 'string' },
                      quantity: { type: 'string' },
                      unit_amount: {
                        type: 'object',
                        properties: {
                          currency_code: { type: 'string' },
                          value: { type: 'string' }
                        }
                      }
                    }
                  }
                }
              },
              required: ['invoice_number', 'reference', 'currency_code', 'recipient_email', 'items']
            }
          }
        ]
      }));
Behavior2/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. It states 'Create' which implies a write/mutation operation, but doesn't address permissions needed, whether the operation is idempotent, rate limits, or what happens on success/failure. This is inadequate for a mutation tool with zero annotation coverage.

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 that states the core purpose without unnecessary words. It's appropriately sized and front-loaded with the essential information.

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 mutation tool with 6 parameters (4 required), 0% schema description coverage, no annotations, and no output schema, the description is severely incomplete. It doesn't explain what the tool returns, error conditions, or provide any context beyond the basic action.

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 6 parameters have descriptions in the schema. The tool description provides no information about any parameters, their meanings, or usage examples. It doesn't compensate for the complete lack of schema documentation.

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 a new product') and the target system ('in PayPal'), which provides a specific verb+resource combination. However, it doesn't differentiate this tool from sibling tools like 'create_invoice' or 'create_order' that also create PayPal resources, so it doesn't reach the highest score.

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 'list_products' or other creation tools. There's no mention of prerequisites, context, or exclusions, leaving the agent without usage direction.

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