Skip to main content
Glama

post_text_activity

Create or update AniList text activities by submitting activity content and ID. Requires login for authorized access to the anilist-mcp server.

Instructions

[Requires Login] Post a new text activity or update an existing one

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesAniList Activity ID (null to create new, number to update)
textYesThe content of the activity

Implementation Reference

  • Handler function that authenticates the user, calls anilist.activity.postText(text, id), and returns the result or error.
    async ({ text, id }) => {
      try {
        const auth = requireAuth(config.anilistToken);
        if (!auth.isAuthorized) {
          return auth.errorResponse;
        }
    
        const result = await anilist.activity.postText(text, id);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [{ type: "text", text: `Error: ${error.message}` }],
          isError: true,
        };
      }
    },
  • Zod input schema defining parameters: text (string) and id (nullable number).
    {
      text: z.string().describe("The content of the activity"),
      id: z
        .number()
        .nullable()
        .describe("AniList Activity ID (null to create new, number to update)"),
    },
  • Registration of the post_text_activity tool via server.tool(), including name, description, input schema, metadata hints, and inline handler.
    server.tool(
      "post_text_activity",
      "[Requires Login] Post a new text activity or update an existing one",
      {
        text: z.string().describe("The content of the activity"),
        id: z
          .number()
          .nullable()
          .describe("AniList Activity ID (null to create new, number to update)"),
      },
      {
        title: "Post or Update an AniList Text Activity",
        readOnlyHint: false,
        destructiveHint: true,
        idempotentHint: false,
        openWorldHint: true,
      },
      async ({ text, id }) => {
        try {
          const auth = requireAuth(config.anilistToken);
          if (!auth.isAuthorized) {
            return auth.errorResponse;
          }
    
          const result = await anilist.activity.postText(text, id);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, 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