Skip to main content
Glama

tag_reviewed_cards

Add review date tags to Anki cards to track when they were last reviewed, using customizable tag prefixes for organization.

Instructions

Add a 'reviewed on date' tag to specified cards

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_idsYesArray of card IDs to tag as reviewed
custom_tag_prefixNoCustom prefix for the tag (default: '見直し')

Implementation Reference

  • src/index.ts:502-522 (registration)
    Registration of the 'tag_reviewed_cards' tool in the ListToolsRequestHandler, including name, description, and input schema
    {
      name: "tag_reviewed_cards",
      description: "Add a 'reviewed on date' tag to specified cards",
      inputSchema: {
        type: "object",
        properties: {
          card_ids: {
            type: "array",
            items: {
              type: "number",
            },
            description: "Array of card IDs to tag as reviewed",
          },
          custom_tag_prefix: {
            type: "string",
            description: "Custom prefix for the tag (default: '見直し')",
          },
        },
        required: ["card_ids"],
      },
    },
  • Main handler function for executing the 'tag_reviewed_cards' tool logic, validates input, calls AnkiConnect to add tags, and returns success response
    private async handleTagReviewedCards(request: any) {
      const cardIds = request.params.arguments?.card_ids;
      const customTagPrefix = request.params.arguments?.custom_tag_prefix;
    
      // Validate card IDs
      if (!cardIds || !Array.isArray(cardIds) || cardIds.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: "Error: No card IDs provided. Please provide an array of card IDs to tag.",
            },
          ],
          isError: true,
        };
      }
    
      // Add tags to cards
      // addTagsは成功してもresultもerrorもnullなので、例外発生しなければ成功
      await this.ankiClient.addTagsToCards(cardIds, customTagPrefix);
    
      const now = new Date();
      const tagDate = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(
        2,
        "0"
      )}${String(now.getDate()).padStart(2, "0")}`;
      const tagPrefix = customTagPrefix || "見直し";
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                message: `Successfully tagged ${cardIds.length} cards with '${tagPrefix}_${tagDate}'`,
                tagged_cards: cardIds,
                tag_added: `${tagPrefix}_${tagDate}`,
                success: true,
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Core helper method in AnkiConnectClient that converts card IDs to note IDs, generates date-based tag, and adds the tag via AnkiConnect API
    async addTagsToCards(
      cardIds: number[],
      customTagPrefix?: string
    ): Promise<boolean> {
      if (cardIds.length === 0) {
        console.error("No cards provided to tag");
        return false;
      }
    
      try {
        // First, get the note IDs for the specified cards
        const cardsInfo = await this.request<any[]>("cardsInfo", {
          cards: cardIds,
        });
    
        // Extract unique note IDs
        const noteIds = [...new Set(cardsInfo.map((card) => card.note))];
    
        if (noteIds.length === 0) {
          console.error("Could not find note IDs for the provided card IDs");
          return false;
        }
    
        // Generate the tag with current date
        const reviewedTag = this.generateReviewedTag(customTagPrefix);
    
        // Add the tag to all notes
        const result = await this.request<boolean>("addTags", {
          notes: noteIds,
          tags: reviewedTag,
        });
    
        return result;
      } catch (error) {
        console.error("Error adding tags to cards:", error);
        throw error;
      }
    }
  • Helper method to generate the date-based reviewed tag string used by addTagsToCards
    private generateReviewedTag(customPrefix: string = "見直し"): string {
      const now = new Date();
      const year = now.getFullYear();
      const month = String(now.getMonth() + 1).padStart(2, "0");
      const day = String(now.getDate()).padStart(2, "0");
      return `${customPrefix}::${year}${month}${day}`;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a mutation ('Add'), but doesn't clarify if this is destructive (e.g., overwrites existing tags), requires authentication, has side effects, or includes error handling. The description is minimal and lacks critical behavioral details for a write operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's mutation nature (adding tags), no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permissions, side effects, or return values, leaving significant gaps for an AI agent to understand how to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (card_ids and custom_tag_prefix). The description adds no additional parameter semantics beyond implying the tag format ('reviewed on date'), which is already suggested by the schema's default value for custom_tag_prefix. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add') and target resource ('tag to specified cards'), with the specific tag content 'reviewed on date' mentioned. However, it doesn't differentiate from the sibling tool 'get_leech_cards' (which presumably retrieves rather than modifies cards), so it doesn't fully distinguish from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention the sibling tool 'get_leech_cards' or any other context for selection, nor does it specify prerequisites like required permissions or system states.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/captain-blue210/anki-mcp-server'

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