Skip to main content
Glama

get_activity

Retrieve a specific AniList activity by its unique ID using the anilist-mcp server. Input the activity ID to fetch detailed activity data directly from the AniList API.

Instructions

Get a specific AniList activity by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activityIDYesThe AniList activity ID

Implementation Reference

  • The handler function for the 'get_activity' tool. It retrieves the specific AniList activity by ID using the anilist library and returns the JSON stringified result or an error message.
    async ({ activityID }) => {
      try {
        const activity = await anilist.activity.get(activityID);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(activity, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [{ type: "text", text: `Error: ${error.message}` }],
          isError: true,
        };
      }
    },
  • Input schema for the 'get_activity' tool, defining the required 'activityID' parameter as a number.
    {
      activityID: z.number().describe("The AniList activity ID"),
    },
  • Registration of the 'get_activity' tool within the registerActivityTools function using McpServer.tool method, including name, description, input schema, metadata, and handler.
    server.tool(
      "get_activity",
      "Get a specific AniList activity by its ID",
      {
        activityID: z.number().describe("The AniList activity ID"),
      },
      {
        title: "Get an AniList Activity",
        readOnlyHint: true,
        openWorldHint: true,
      },
      async ({ activityID }) => {
        try {
          const activity = await anilist.activity.get(activityID);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(activity, null, 2),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `Error: ${error.message}` }],
            isError: true,
          };
        }
      },
    );

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/yuna0x0/anilist-mcp'

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