Skip to main content
Glama

push_flex_message

Send customizable flex messages to LINE users with bubble or carousel layouts for enhanced visual communication.

Instructions

Push a highly customizable flex message to a user via LINE. Supports both bubble (single container) and carousel (multiple swipeable bubbles) layouts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYes
userIdNoThe user ID to receive a message. Defaults to DESTINATION_USER_ID.U1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p

Implementation Reference

  • The handler function that executes the tool: pushes the flex message to the specified user via LINE Messaging API, with error handling.
    async ({ userId, message }) => { if (!userId) { return createErrorResponse(NO_USER_ID_ERROR); } try { const response = await this.client.pushMessage({ to: userId, messages: [message as unknown as messagingApi.Message], }); return createSuccessResponse(response); } catch (error) { return createErrorResponse( `Failed to push flex message: ${error.message}`, ); } },
  • Zod schema for input 'message' parameter defining the flex message structure (bubble or carousel).
    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.", ), });
  • Registers the 'push_flex_message' tool on the MCP server within the PushFlexMessage class's register method, specifying name, description, input schema, and handler.
    server.tool( "push_flex_message", "Push a highly customizable flex message to a user via LINE. Supports both bubble (single container) and carousel " + "(multiple swipeable bubbles) layouts.", { userId: userIdSchema, message: flexMessageSchema, }, async ({ userId, message }) => { if (!userId) { return createErrorResponse(NO_USER_ID_ERROR); } try { const response = await this.client.pushMessage({ to: userId, messages: [message as unknown as messagingApi.Message], }); return createSuccessResponse(response); } catch (error) { return createErrorResponse( `Failed to push flex message: ${error.message}`, ); } }, );
  • src/index.ts:62-62 (registration)
    Instantiates PushFlexMessage tool with LINE client and destination ID, then calls register to add the tool to the MCP server.
    new PushFlexMessage(messagingApiClient, destinationId).register(server);

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/tndfame/mcp_management'

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