find_counters
Find One Piece TCG cards with counter values to build defensive deck strategies. Filter by color and cost to identify cards that can block opponent attacks.
Instructions
Find One Piece TCG cards with counter values. Useful for building defensive deck strategies. Filter by color and cost.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | Filter by color: Red, Blue, Green, Purple, Yellow, Black | |
| cost_max | No | Maximum cost for counter cards | |
| limit | No | Max results |
Implementation Reference
- src/tools/find-counters.ts:18-59 (handler)The async handler function that performs the logic for searching counter cards using 'searchCards', processes the results, and formats the output.
async ({ color, cost_max, limit }) => { const result = searchCards({ has_counter: true, color, cost_max, card_type: 'CHARACTER', limit: limit ?? 20, }); if (result.total === 0) { return { isError: true, content: [ { type: 'text' as const, text: 'No counter cards found matching your filters.', }, ], }; } // Sort by counter value descending const sorted = [...result.cards].sort((a, b) => { const ca = parseInt(a.counter, 10) || 0; const cb = parseInt(b.counter, 10) || 0; return cb - ca; }); const lines = [ `# Counter Cards (${result.total} found, showing ${sorted.length})`, '', ...sorted.map( (c) => `${formatCardBrief(c)} | Counter +${c.counter}`, ), ]; return { content: [{ type: 'text' as const, text: lines.join('\n') }], }; }, ); - src/tools/find-counters.ts:12-16 (schema)The input schema for the 'find_counters' tool, defining available parameters like color, cost_max, and limit with validation.
inputSchema: { color: z.string().optional().describe('Filter by color: Red, Blue, Green, Purple, Yellow, Black'), cost_max: z.number().optional().describe('Maximum cost for counter cards'), limit: z.number().min(1).max(50).optional().default(20).describe('Max results'), }, - src/tools/find-counters.ts:6-60 (registration)The registration function that defines the 'find_counters' tool name, description, schema, and handler logic on the McpServer instance.
export function registerFindCounters(server: McpServer): void { server.registerTool( 'find_counters', { description: 'Find One Piece TCG cards with counter values. Useful for building defensive deck strategies. Filter by color and cost.', inputSchema: { color: z.string().optional().describe('Filter by color: Red, Blue, Green, Purple, Yellow, Black'), cost_max: z.number().optional().describe('Maximum cost for counter cards'), limit: z.number().min(1).max(50).optional().default(20).describe('Max results'), }, }, async ({ color, cost_max, limit }) => { const result = searchCards({ has_counter: true, color, cost_max, card_type: 'CHARACTER', limit: limit ?? 20, }); if (result.total === 0) { return { isError: true, content: [ { type: 'text' as const, text: 'No counter cards found matching your filters.', }, ], }; } // Sort by counter value descending const sorted = [...result.cards].sort((a, b) => { const ca = parseInt(a.counter, 10) || 0; const cb = parseInt(b.counter, 10) || 0; return cb - ca; }); const lines = [ `# Counter Cards (${result.total} found, showing ${sorted.length})`, '', ...sorted.map( (c) => `${formatCardBrief(c)} | Counter +${c.counter}`, ), ]; return { content: [{ type: 'text' as const, text: lines.join('\n') }], }; }, ); }