browse_leaders
Find One Piece TCG Leader cards by color to build decks with compatible leaders. Filter by Red, Blue, Green, Purple, Yellow, or Black to match your deck strategy.
Instructions
Browse all One Piece TCG Leader cards. Filter by color to find leaders for a specific deck color.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | Filter by color: Red, Blue, Green, Purple, Yellow, Black |
Implementation Reference
- src/tools/browse-leaders.ts:16-55 (handler)The handler function that retrieves and filters leader cards based on the provided color input and formats the output.
async ({ color }) => { let leaders = getLeaders(); if (color) { const c = color.toLowerCase(); leaders = leaders.filter((l) => l.colors.some((cl) => cl.toLowerCase() === c), ); } if (leaders.length === 0) { return { isError: true, content: [ { type: 'text' as const, text: color ? `No leaders found for color "${color}". Available colors: Red, Blue, Green, Purple, Yellow, Black.` : 'No leaders found.', }, ], }; } const header = color ? `# ${color} Leaders (${leaders.length})` : `# All Leaders (${leaders.length})`; const lines = [header, '']; for (const leader of leaders) { lines.push(formatCard(leader)); lines.push(''); lines.push('---'); lines.push(''); } return { content: [{ type: 'text' as const, text: lines.join('\n') }], }; }, - src/tools/browse-leaders.ts:12-14 (schema)Input schema definition for the browse_leaders tool.
inputSchema: { color: z.string().optional().describe('Filter by color: Red, Blue, Green, Purple, Yellow, Black'), }, - src/tools/browse-leaders.ts:6-56 (registration)Tool registration function for browse_leaders.
export function registerBrowseLeaders(server: McpServer): void { server.registerTool( 'browse_leaders', { description: 'Browse all One Piece TCG Leader cards. Filter by color to find leaders for a specific deck color.', inputSchema: { color: z.string().optional().describe('Filter by color: Red, Blue, Green, Purple, Yellow, Black'), }, }, async ({ color }) => { let leaders = getLeaders(); if (color) { const c = color.toLowerCase(); leaders = leaders.filter((l) => l.colors.some((cl) => cl.toLowerCase() === c), ); } if (leaders.length === 0) { return { isError: true, content: [ { type: 'text' as const, text: color ? `No leaders found for color "${color}". Available colors: Red, Blue, Green, Purple, Yellow, Black.` : 'No leaders found.', }, ], }; } const header = color ? `# ${color} Leaders (${leaders.length})` : `# All Leaders (${leaders.length})`; const lines = [header, '']; for (const leader of leaders) { lines.push(formatCard(leader)); lines.push(''); lines.push('---'); lines.push(''); } return { content: [{ type: 'text' as const, text: lines.join('\n') }], }; }, );