Skip to main content
Glama

search_cards

Search Yu-Gi-Oh! cards by keywords, including card names and effect descriptions, using this tool on the ygocdb-mcp server to quickly find relevant cards.

Instructions

通过关键字搜索游戏王卡牌,可以搜索卡牌名称、效果文本等。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes搜索关键字,可以是卡牌名称、效果描述等

Implementation Reference

  • The handler function for the 'search_cards' tool. It constructs the YGOCDB search API URL using the provided query and optional config, fetches the response, and processes it via handleYgocdbResponse.
    async function handleSearchCards(query: string, config?: z.infer<typeof configSchema>) {
      const url = `${config?.apiUrl || BASE_URL}/?search=${encodeURIComponent(query)}`;
      const response = await fetch(url);
      return handleYgocdbResponse(response);
    }
  • Schema definition for the 'search_cards' tool, including name, description, input schema requiring a 'query' string, and annotations.
    const SEARCH_CARDS_TOOL: Tool = {
      name: "search_cards",
      description:
        "通过关键字搜索游戏王卡牌,可以搜索卡牌名称、效果文本等。",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "搜索关键字,可以是卡牌名称、效果描述等"
          }
        },
        required: ["query"]
      },
      annotations: {
        title: "通过关键字搜索游戏王卡牌",
        readOnlyHint: true,
        openWorldHint: true
      }
    };
  • index.ts:136-140 (registration)
    Registration of the 'search_cards' tool in the YGOCDB_TOOLS array, which is returned by the ListToolsRequestHandler.
    const YGOCDB_TOOLS = [
      SEARCH_CARDS_TOOL,
      GET_CARD_BY_ID_TOOL,
      GET_CARD_IMAGE_TOOL
    ] as const;
  • index.ts:276-278 (registration)
    MCP server registration of the tools list handler, which exposes the 'search_cards' tool via ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: YGOCDB_TOOLS
    }));
  • index.ts:285-288 (registration)
    Dispatch case in the CallToolRequestHandler switch statement that routes 'search_cards' calls to the handleSearchCards function.
    case "search_cards": {
      const { query } = args as { query: string };
      return await handleSearchCards(query, config);
    }
Install Server

Other Tools

Related 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/lieyanqzu/ygocdb-mcp'

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