Skip to main content
Glama
gregario

onepiece-oracle

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
NameRequiredDescriptionDefault
colorNoFilter by color: Red, Blue, Green, Purple, Yellow, Black
cost_maxNoMaximum cost for counter cards
limitNoMax results

Implementation Reference

  • 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') }],
        };
      },
    );
  • 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'),
    },
  • 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') }],
          };
        },
      );
    }

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/gregario/onepiece-oracle'

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