Skip to main content
Glama
gavxm
by gavxm

anilist_genre_list

Read-only

Retrieve valid AniList genres and content tags grouped by category with descriptions. Use this list to ensure accurate genre names before applying filters.

Instructions

List all valid AniList genres and content tags. Use before genre-filtering tools to ensure valid genre names. Returns genres and content tags grouped by category with descriptions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeAdultTagsNoInclude adult/NSFW tags in the list
filterNoShow only genres, only tags, or both (default all)all
categoryNoFilter tags to a specific category (e.g. Theme, Setting, Cast)

Implementation Reference

  • The execute function that handles the anilist_genre_list tool - queries AniList API for genres and tags, filters based on args, groups tags by category, and returns formatted output.
      execute: async (args) => {
        try {
          const data = await anilistClient.query<GenreTagCollectionResponse>(
            GENRE_TAG_COLLECTION_QUERY,
            {},
            { cache: "media" },
          );
    
          const lines: string[] = [];
    
          // Genres section
          if (args.filter !== "tags") {
            lines.push("# AniList Genres", "", data.GenreCollection.join(", "));
          }
    
          // Tags section
          if (args.filter !== "genres") {
            let tags = data.MediaTagCollection;
            if (!args.includeAdultTags) {
              tags = tags.filter((t) => !t.isAdult);
            }
    
            // Group tags by category
            const categories = new Map<
              string,
              Array<{ name: string; description: string }>
            >();
            for (const tag of tags) {
              const cat = tag.category || "Other";
              if (
                args.category &&
                !cat.toLowerCase().startsWith(args.category.toLowerCase())
              )
                continue;
              const list = categories.get(cat);
              if (list) {
                list.push(tag);
              } else {
                categories.set(cat, [tag]);
              }
            }
    
            if (lines.length > 0) lines.push("");
            lines.push("# Content Tags");
            for (const [category, catTags] of categories) {
              lines.push("", `## ${category}`);
              for (const tag of catTags) {
                lines.push(`  ${tag.name} - ${tag.description}`);
              }
            }
          }
    
          return lines.join("\n");
        } catch (error) {
          return throwToolError(error, "fetching genre list");
        }
      },
    });
  • Registration of the anilist_genre_list tool via server.addTool with name, description, parameters, annotations, and execute handler.
    server.addTool({
      name: "anilist_genre_list",
      description:
        "List all valid AniList genres and content tags. " +
        "Use before genre-filtering tools to ensure valid genre names. " +
        "Returns genres and content tags grouped by category with descriptions.",
      parameters: GenreListInputSchema,
      annotations: {
        title: "List Genres & Tags",
        readOnlyHint: true,
        destructiveHint: false,
        openWorldHint: true,
      },
      execute: async (args) => {
        try {
          const data = await anilistClient.query<GenreTagCollectionResponse>(
            GENRE_TAG_COLLECTION_QUERY,
            {},
            { cache: "media" },
          );
    
          const lines: string[] = [];
    
          // Genres section
          if (args.filter !== "tags") {
            lines.push("# AniList Genres", "", data.GenreCollection.join(", "));
          }
    
          // Tags section
          if (args.filter !== "genres") {
            let tags = data.MediaTagCollection;
            if (!args.includeAdultTags) {
              tags = tags.filter((t) => !t.isAdult);
            }
    
            // Group tags by category
            const categories = new Map<
              string,
              Array<{ name: string; description: string }>
            >();
            for (const tag of tags) {
              const cat = tag.category || "Other";
              if (
                args.category &&
                !cat.toLowerCase().startsWith(args.category.toLowerCase())
              )
                continue;
              const list = categories.get(cat);
              if (list) {
                list.push(tag);
              } else {
                categories.set(cat, [tag]);
              }
            }
    
            if (lines.length > 0) lines.push("");
            lines.push("# Content Tags");
            for (const [category, catTags] of categories) {
              lines.push("", `## ${category}`);
              for (const tag of catTags) {
                lines.push(`  ${tag.name} - ${tag.description}`);
              }
            }
          }
    
          return lines.join("\n");
        } catch (error) {
          return throwToolError(error, "fetching genre list");
        }
      },
    });
  • Zod schema for GenreListInput: includeAdultTags (boolean, default false), filter (enum all/genres/tags, default all), category (optional string).
    export const GenreListInputSchema = z.object({
      includeAdultTags: z
        .boolean()
        .default(false)
        .describe("Include adult/NSFW tags in the list"),
      filter: z
        .enum(["all", "genres", "tags"])
        .default("all")
        .describe("Show only genres, only tags, or both (default all)"),
      category: z
        .string()
        .optional()
        .describe("Filter tags to a specific category (e.g. Theme, Setting, Cast)"),
    });
  • GraphQL query GENRE_TAG_COLLECTION_QUERY used to fetch GenreCollection and MediaTagCollection with name, description, category, isAdult fields.
    export const GENRE_TAG_COLLECTION_QUERY = `
      query GenreTagCollection {
        GenreCollection
        MediaTagCollection {
          name
          description
          category
          isAdult
        }
      }
    `;
  • TypeScript interface GenreTagCollectionResponse defining the shape of the API response for genre/tag queries.
    export interface GenreTagCollectionResponse {
      GenreCollection: string[];
      MediaTagCollection: Array<{
        name: string;
        description: string;
        category: string;
        isAdult: boolean;
      }>;
    }
Behavior4/5

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

The description adds value beyond annotations by specifying that it list all valid items, groups them by category, and includes descriptions. This aligns with the readOnlyHint and destructiveHint=false, providing clear behavioral context without contradiction.

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 extremely concise with two sentences that front-load the purpose and usage guidance. Every sentence is necessary and informative, with no irrelevant details.

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

Completeness5/5

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

Given the tool's simplicity, no output schema, and annotations that indicate it is read-only, the description fully covers what the tool returns (genres and tags grouped by category with descriptions). It is complete and unambiguous.

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?

The input schema has 100% coverage with clear descriptions for all three parameters (includeAdultTags, filter, category). The tool description does not add any additional meaning beyond what the schema already provides, so a baseline score of 3 is appropriate.

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 that the tool lists all valid AniList genres and content tags, uses a specific verb (list), and specifies the resource (genres and tags). It also distinguishes itself from potential sibling tools like 'anilist_genres' by emphasizing it returns both genres and tags grouped by category with descriptions.

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 explicitly instructs to use it before genre-filtering tools to ensure valid genre names, providing clear context for when to use it. It does not mention specific alternatives or when not to use it, but the guidance is sufficient for an agent to understand its role.

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