Skip to main content
Glama
gregario

onepiece-oracle

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
NameRequiredDescriptionDefault
colorNoFilter by color: Red, Blue, Green, Purple, Yellow, Black

Implementation Reference

  • 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') }],
      };
    },
  • Input schema definition for the browse_leaders tool.
    inputSchema: {
      color: z.string().optional().describe('Filter by color: Red, Blue, Green, Purple, Yellow, Black'),
    },
  • 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') }],
          };
        },
      );

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