Skip to main content
Glama

get_card_by_id

Retrieve detailed information for a specific Yu-Gi-Oh! card using its unique ID. Input the card ID to access card details instantly via the ygocdb-mcp server.

Instructions

通过卡牌ID获取单张游戏王卡牌的详细信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes游戏王卡牌ID,通常为八位数字

Implementation Reference

  • The main handler function that fetches the card data from YGOCDB API using the provided ID as a search query and processes the response using the shared response handler.
    async function handleGetCardById(id: string, config?: z.infer<typeof configSchema>) {
      const url = `${config?.apiUrl || BASE_URL}/?search=${encodeURIComponent(id)}`;
      const response = await fetch(url);
      return handleYgocdbResponse(response);
    }
  • The Tool object defining the schema, including inputSchema for the 'id' parameter (string, required), description, and annotations.
    const GET_CARD_BY_ID_TOOL: Tool = {
      name: "get_card_by_id",
      description: "通过卡牌ID获取单张游戏王卡牌的详细信息",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "游戏王卡牌ID,通常为八位数字"
          }
        },
        required: ["id"]
      },
      annotations: {
        title: "通过ID获取单张游戏王卡牌",
        readOnlyHint: true,
        openWorldHint: true
      }
    };
  • index.ts:136-140 (registration)
    The tool is registered in the YGOCDB_TOOLS array, which is returned by the listTools request handler.
    const YGOCDB_TOOLS = [
      SEARCH_CARDS_TOOL,
      GET_CARD_BY_ID_TOOL,
      GET_CARD_IMAGE_TOOL
    ] as const;
  • index.ts:289-292 (registration)
    The tool name is matched in the switch statement within the CallToolRequestSchema handler, dispatching to the handleGetCardById function.
    case "get_card_by_id": {
      const { id } = args as { id: string };
      return await handleGetCardById(id, 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