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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | AniList Activity ID (null to create new, number to update) | |
| isPrivate | No | Set to true if it is a private message | |
| recipientId | Yes | The target user to send the message to | |
| text | Yes | The activity message text |
Implementation Reference
- tools/activity.ts:157-184 (handler)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, }; } },
- tools/activity.ts:135-149 (schema)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)"), },
- tools/activity.ts:132-185 (registration)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, }; } }, );