broadcast_flex_message
Send customizable flex messages to all LINE Official Account followers. Create bubble or carousel layouts with rich content for announcements and updates.
Instructions
Broadcast a highly customizable flex message via LINE to all users who have added your LINE Official Account. Supports both bubble (single container) and carousel (multiple swipeable bubbles) layouts. Please be aware that this message will be sent to all users.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes |
Implementation Reference
- src/tools/broadcastFlexMessage.ts:27-39 (handler)The asynchronous handler function that performs the broadcast_flex_message tool logic by calling the LINE Messaging API's broadcast method with the provided flex message.async ({ message }) => { try { const response = await this.client.broadcast({ messages: [message as unknown as messagingApi.Message], }); return createSuccessResponse(response); } catch (error) { return createErrorResponse( `Failed to broadcast message: ${error.message}`, ); } }, );
- Zod schema defining the structure of the input 'message' parameter for the broadcast_flex_message tool.export const flexMessageSchema = z.object({ type: z.literal("flex").default("flex"), altText: z .string() .describe("Alternative text shown when flex message cannot be displayed."), contents: z .object({ type: z .enum(["bubble", "carousel"]) .describe( "Type of the container. 'bubble' for single container, 'carousel' for multiple swipeable bubbles.", ), }) .passthrough() .describe( "Flexible container structure following LINE Flex Message format. For 'bubble' type, can include header, " + "hero, body, footer, and styles sections. For 'carousel' type, includes an array of bubble containers in " + "the 'contents' property.", ), });
- src/tools/broadcastFlexMessage.ts:18-40 (registration)The register method that sets up the 'broadcast_flex_message' tool on the MCP server, including name, description, input schema reference, and handler function.register(server: McpServer) { server.tool( "broadcast_flex_message", "Broadcast a highly customizable flex message via LINE to all users who have added your LINE Official Account. " + "Supports both bubble (single container) and carousel (multiple swipeable bubbles) layouts. Please be aware that " + "this message will be sent to all users.", { message: flexMessageSchema, }, async ({ message }) => { try { const response = await this.client.broadcast({ messages: [message as unknown as messagingApi.Message], }); return createSuccessResponse(response); } catch (error) { return createErrorResponse( `Failed to broadcast message: ${error.message}`, ); } }, ); }
- src/index.ts:64-64 (registration)Instantiates the BroadcastFlexMessage class with the messaging API client and calls its register method on the main MCP server.new BroadcastFlexMessage(messagingApiClient).register(server);