Skip to main content
Glama

post_message_activity

Send or update messages on AniList via the MCP server. Specify text, recipient, and privacy settings to manage user activities efficiently.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesAniList Activity ID (null to create new, number to update)
isPrivateNoSet to true if it is a private message
recipientIdYesThe target user to send the message to
textYesThe activity message text

Implementation Reference

  • The handler function for the 'post_message_activity' tool. It authenticates the user using requireAuth, calls the anilist.activity.postMessage method with the provided text, recipientId, isPrivate, and id parameters, and returns a formatted response with the result or an error.
    async ({ text, recipientId, isPrivate, id }) => {
      try {
        const auth = requireAuth(config.anilistToken);
        if (!auth.isAuthorized) {
          return auth.errorResponse;
        }
    
        const result = await anilist.activity.postMessage(
          text,
          recipientId,
          isPrivate,
          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 for the 'post_message_activity' tool: text (string), recipientId (number), isPrivate (boolean, optional default false), id (number nullable).
    {
      text: z.string().describe("The activity message text"),
      recipientId: z
        .number()
        .describe("The target user to send the message to"),
      isPrivate: z
        .boolean()
        .optional()
        .default(false)
        .describe("Set to true if it is a private message"),
      id: z
        .number()
        .nullable()
        .describe("AniList Activity ID (null to create new, number to update)"),
    },
  • Registration of the 'post_message_activity' tool on the MCP server within registerActivityTools, including name, description, input schema, metadata hints, and inline handler function.
    server.tool(
      "post_message_activity",
      "[Requires Login] Post a new message activity or update an existing one",
      {
        text: z.string().describe("The activity message text"),
        recipientId: z
          .number()
          .describe("The target user to send the message to"),
        isPrivate: z
          .boolean()
          .optional()
          .default(false)
          .describe("Set to true if it is a private message"),
        id: z
          .number()
          .nullable()
          .describe("AniList Activity ID (null to create new, number to update)"),
      },
      {
        title: "Post or Update an AniList Message Activity",
        readOnlyHint: false,
        destructiveHint: true,
        idempotentHint: false,
        openWorldHint: true,
      },
      async ({ text, recipientId, isPrivate, id }) => {
        try {
          const auth = requireAuth(config.anilistToken);
          if (!auth.isAuthorized) {
            return auth.errorResponse;
          }
    
          const result = await anilist.activity.postMessage(
            text,
            recipientId,
            isPrivate,
            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