Skip to main content
Glama
gavxm
by gavxm

anilist_add_to_list

DestructiveIdempotent

Add an anime or manga to your list with a status such as watching, planning, or completed. Supports optional scoring and returns the entry ID.

Instructions

Add an anime or manga to your list with a status. Use when the user wants to start watching, plan to watch, or mark a title as completed. Requires ANILIST_TOKEN. Returns status, optional score, and entry ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mediaIdYesAniList media ID to add to the list
statusYesList status to set
scoreNoScore on a 0-10 scale (e.g. 8.5). Omit to leave unscored.

Implementation Reference

  • The 'anilist_add_to_list' tool handler: executes the tool logic by calling SAVE_MEDIA_LIST_ENTRY_MUTATION with mediaId, status, and optional score (converted to scoreRaw). Snapshots the entry before mutation for undo support, invalidates caches, and returns the result with status, optional formatted score, entry ID, and undo hint.
    server.addTool({
      name: "anilist_add_to_list",
      description:
        "Add an anime or manga to your list with a status. " +
        "Use when the user wants to start watching, plan to watch, " +
        "or mark a title as completed. Requires ANILIST_TOKEN. " +
        "Returns status, optional score, and entry ID.",
      parameters: AddToListInputSchema,
      annotations: {
        title: "Add to List",
        readOnlyHint: false,
        destructiveHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      execute: async (args) => {
        try {
          requireAuth();
    
          // Snapshot before mutation
          const before = await snapshotByMediaId(args.mediaId);
    
          const variables: Record<string, unknown> = {
            mediaId: args.mediaId,
            status: args.status,
          };
          if (args.score !== undefined)
            variables.scoreRaw = Math.round(args.score * 10);
    
          const [data, scoreFmt] = await Promise.all([
            anilistClient.query<SaveMediaListEntryResponse>(
              SAVE_MEDIA_LIST_ENTRY_MUTATION,
              variables,
              { cache: null },
            ),
            getScoreFormat(),
          ]);
    
          const viewerName = await getViewerName();
          anilistClient.invalidateUser(viewerName);
          invalidateUserProfiles(viewerName);
    
          const entry = data.SaveMediaListEntry;
    
          // Track for undo
          pushUndo({
            operation: before
              ? { type: "update", before }
              : { type: "create", entryId: entry.id, mediaId: args.mediaId },
            toolName: "anilist_add_to_list",
            timestamp: Date.now(),
            description: `Set status to ${args.status} on media ${args.mediaId}`,
          });
    
          const scoreStr =
            entry.score > 0
              ? ` | Score: ${formatScore(entry.score, scoreFmt)}`
              : "";
          return [
            `Added to list.`,
            `Status: ${entry.status}${scoreStr}`,
            `Entry ID: ${entry.id}`,
            undoHint(before),
          ].join("\n");
        } catch (error) {
          return throwToolError(error, "adding to list");
        }
      },
  • Registration of the 'anilist_add_to_list' tool on the FastMCP server via server.addTool() inside registerWriteTools(). Also sets annotations (non-readOnly, destructive, idempotent, openWorld).
    server.addTool({
      name: "anilist_add_to_list",
      description:
        "Add an anime or manga to your list with a status. " +
        "Use when the user wants to start watching, plan to watch, " +
        "or mark a title as completed. Requires ANILIST_TOKEN. " +
        "Returns status, optional score, and entry ID.",
      parameters: AddToListInputSchema,
      annotations: {
        title: "Add to List",
        readOnlyHint: false,
        destructiveHint: true,
        idempotentHint: true,
        openWorldHint: true,
      },
      execute: async (args) => {
        try {
          requireAuth();
    
          // Snapshot before mutation
          const before = await snapshotByMediaId(args.mediaId);
    
          const variables: Record<string, unknown> = {
            mediaId: args.mediaId,
            status: args.status,
          };
          if (args.score !== undefined)
            variables.scoreRaw = Math.round(args.score * 10);
    
          const [data, scoreFmt] = await Promise.all([
            anilistClient.query<SaveMediaListEntryResponse>(
              SAVE_MEDIA_LIST_ENTRY_MUTATION,
              variables,
              { cache: null },
            ),
            getScoreFormat(),
          ]);
    
          const viewerName = await getViewerName();
          anilistClient.invalidateUser(viewerName);
          invalidateUserProfiles(viewerName);
    
          const entry = data.SaveMediaListEntry;
    
          // Track for undo
          pushUndo({
            operation: before
              ? { type: "update", before }
              : { type: "create", entryId: entry.id, mediaId: args.mediaId },
            toolName: "anilist_add_to_list",
            timestamp: Date.now(),
            description: `Set status to ${args.status} on media ${args.mediaId}`,
          });
    
          const scoreStr =
            entry.score > 0
              ? ` | Score: ${formatScore(entry.score, scoreFmt)}`
              : "";
          return [
            `Added to list.`,
            `Status: ${entry.status}${scoreStr}`,
            `Entry ID: ${entry.id}`,
            undoHint(before),
          ].join("\n");
        } catch (error) {
          return throwToolError(error, "adding to list");
        }
      },
    });
  • The AddToListInputSchema Zod schema defining the three input fields: mediaId (positive int), status (enum: CURRENT/PLANNING/COMPLETED/DROPPED/PAUSED/REPEATING), and score (0-10, optional).
    export const AddToListInputSchema = z.object({
      mediaId: z
        .number()
        .int()
        .positive()
        .describe("AniList media ID to add to the list"),
      status: z
        .enum([
          "CURRENT",
          "PLANNING",
          "COMPLETED",
          "DROPPED",
          "PAUSED",
          "REPEATING",
        ])
        .describe("List status to set"),
      score: z
        .number()
        .min(0)
        .max(10)
        .optional()
        .describe("Score on a 0-10 scale (e.g. 8.5). Omit to leave unscored."),
    });
    
    export type AddToListInput = z.infer<typeof AddToListInputSchema>;
  • Import of registerWriteTools from ./tools/write.js, called at line 60 to register all write tools including anilist_add_to_list on the MCP server.
    import { registerWriteTools } from "./tools/write.js";
    import { registerSocialTools } from "./tools/social.js";
    import { registerAnalyticsTools } from "./tools/analytics.js";
    import { registerImportTools } from "./tools/import.js";
    import { registerCardTools } from "./tools/cards.js";
    import { registerResources } from "./resources.js";
    import { registerPrompts } from "./prompts.js";
    
    // Sanitize env vars: clear unresolved templates, placeholders, or invalid values
    for (const key of ["ANILIST_USERNAME", "ANILIST_TOKEN"] as const) {
      const val = process.env[key] ?? "";
      if (!val || val.startsWith("${") || val === "undefined" || val === "null") {
        process.env[key] = "";
      }
    }
    // AniList tokens are long JWT-like strings (100+ chars)
    if (process.env.ANILIST_TOKEN && process.env.ANILIST_TOKEN.length < 30) {
      console.warn("[ani-mcp] ANILIST_TOKEN looks invalid (too short), ignoring.");
      process.env.ANILIST_TOKEN = "";
    }
    
    // Both vars are optional - warn on missing so operators know what's available
    if (!process.env.ANILIST_USERNAME) {
      console.warn(
        "ANILIST_USERNAME not set - tools will require a username argument.",
      );
    }
    if (!process.env.ANILIST_TOKEN) {
      console.warn("ANILIST_TOKEN not set - authenticated features unavailable.");
    }
    
    const server = new FastMCP({
      name: "ani-mcp",
      version: "0.15.4",
      instructions:
        "ani-mcp is a local MCP server for AniList. " +
        "Read-only tools work without authentication. " +
        "Write tools require ANILIST_TOKEN set in the server's environment config. " +
        "If a tool says the token is not set, tell the user to add ANILIST_TOKEN " +
        "to their MCP server config and restart. " +
        "There is no in-app AniList integration or settings page to connect.",
Behavior4/5

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

Annotations indicate destructiveHint=true and idempotentHint=true, which the description does not contradict. The description adds valuable context: the requirement for ANILIST_TOKEN and the return of status, score, and entry ID.

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?

Two concise sentences: first states the purpose, second provides usage guidance, auth requirement, and return info. No superfluous text.

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

Completeness4/5

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

Given no output schema, the description adequately covers the return (status, optional score, entry ID) and auth requirement. It could mention the full set of statuses, but the schema already lists them.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds meaning by explaining the score's optionality and range (0-10) and mentioning the entry ID return value, which is not in the schema.

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

Purpose5/5

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

The description clearly states the action ('Add an anime or manga to your list'), the resource (media), and the key parameter (status). It distinguishes from sibling tools like delete or update by specifying the list addition operation.

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

Usage Guidelines4/5

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

The description provides explicit usage scenarios: 'when the user wants to start watching, plan to watch, or mark a title as completed.' This guides the agent on when to invoke this tool, though it does not explicitly contrast with alternatives.

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/gavxm/ani-mcp'

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