Skip to main content
Glama

create_pokepaste

Generate shareable Pokepaste URLs from Pokémon team data to format and share competitive teams via a simple API.

Instructions

Create a Pokepaste from Pokemon set data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pokemonYesArray of Pokemon set objects
titleNoOptional title for the paste
authorNoOptional author name
notesNoOptional notes

Implementation Reference

  • The core handler function that converts Pokemon sets to Pokepaste text format using Sets.exportSet, posts it to pokepast.es/create via fetch, handles the 303 redirect to get the paste URL, and returns it or throws an error.
    async function createPokepaste(pokemonSets: any[], title?: string, author?: string, notes?: string): Promise<string> { const pokemonStrings = pokemonSets.map(set => Sets.exportSet(set)); const pasteContent = pokemonStrings.join('\n\n'); const formData = new URLSearchParams(); formData.append('paste', pasteContent); if (title) formData.append('title', title); if (author) formData.append('author', author); if (notes) formData.append('notes', notes); const response = await fetch('https://pokepast.es/create', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: formData, redirect: 'manual' }); if (response.status === 303) { const location = response.headers.get('location'); if (location) { return `https://pokepast.es${location}`; } } throw new Error(`Failed to create pokepaste: ${response.status} ${response.statusText}`); }
  • Zod schema for validating the input arguments to the create_pokepaste tool, including array of PokemonSetSchema objects and optional title, author, notes.
    const CreatePokepasteSchema = z.object({ pokemon: z.array(PokemonSetSchema), title: z.string().optional(), author: z.string().optional(), notes: z.string().optional(), });
  • Detailed Zod schema defining a Pokemon set object, used within CreatePokepasteSchema, including all fields like moves, evs, ivs, etc.
    const PokemonSetSchema = z.object({ name: z.string(), species: z.string(), item: z.string(), ability: z.string(), moves: z.array(z.string()), nature: z.string(), gender: z.string(), evs: StatsTableSchema, ivs: StatsTableSchema, level: z.number(), shiny: z.boolean().optional(), happiness: z.number().optional(), pokeball: z.string().optional(), hpType: z.string().optional(), dynamaxLevel: z.number().optional(), gigantamax: z.boolean().optional(), teraType: z.string().optional(), });
  • src/index.ts:95-162 (registration)
    Tool registration in ListTools response, defining name, description, and detailed JSON inputSchema matching the Zod schema.
    { name: "create_pokepaste", description: "Create a Pokepaste from Pokemon set data", inputSchema: { type: "object", properties: { pokemon: { type: "array", description: "Array of Pokemon set objects", items: { type: "object", properties: { name: { type: "string", description: "Pokemon nickname" }, species: { type: "string", description: "Pokemon species" }, item: { type: "string", description: "Held item" }, ability: { type: "string", description: "Pokemon ability" }, moves: { type: "array", items: { type: "string" }, description: "Array of move names" }, nature: { type: "string", description: "Pokemon nature" }, gender: { type: "string", description: "Pokemon gender (M/F/N)" }, evs: { type: "object", description: "Effort Values", properties: { hp: { type: "number" }, atk: { type: "number" }, def: { type: "number" }, spa: { type: "number" }, spd: { type: "number" }, spe: { type: "number" } }, required: ["hp", "atk", "def", "spa", "spd", "spe"] }, ivs: { type: "object", description: "Individual Values", properties: { hp: { type: "number" }, atk: { type: "number" }, def: { type: "number" }, spa: { type: "number" }, spd: { type: "number" }, spe: { type: "number" } }, required: ["hp", "atk", "def", "spa", "spd", "spe"] }, level: { type: "number", description: "Pokemon level" }, shiny: { type: "boolean", description: "Is shiny", default: false }, happiness: { type: "number", description: "Pokemon happiness" }, pokeball: { type: "string", description: "Pokeball type" }, hpType: { type: "string", description: "Hidden Power type" }, dynamaxLevel: { type: "number", description: "Dynamax level" }, gigantamax: { type: "boolean", description: "Can Gigantamax" }, teraType: { type: "string", description: "Tera type" } }, required: ["name", "species", "item", "ability", "moves", "nature", "gender", "evs", "ivs", "level"] } }, title: { type: "string", description: "Optional title for the paste" }, author: { type: "string", description: "Optional author name" }, notes: { type: "string", description: "Optional notes" } }, required: ["pokemon"] } }
  • src/index.ts:170-199 (registration)
    Dispatch logic in CallToolRequestHandler that validates arguments using CreatePokepasteSchema, calls the createPokepaste handler, and returns success/error content.
    if (name === "create_pokepaste") { try { const validatedArgs = CreatePokepasteSchema.parse(args); const url = await createPokepaste( validatedArgs.pokemon, validatedArgs.title, validatedArgs.author, validatedArgs.notes ); return { content: [ { type: "text", text: `Successfully created Pokepaste: ${url}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating Pokepaste: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }

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/jpbullalayao/pokemon-paste-mcp'

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