Skip to main content
Glama
tndfame
by tndfame

push_flex_message

Send customizable flex messages to LINE users with bubble or carousel layouts for interactive content delivery.

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
userIdNoThe user ID to receive a message. Defaults to DESTINATION_USER_ID.U1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p
messageYes

Implementation Reference

  • The core handler function that validates the userId, pushes the flex message to the LINE API client, and returns success or error response.
    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 defining the structure of the flex message input, including type, altText, and contents (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 with the MCP server, specifying the name, description, input schema (userId and message), and the handler function.
    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 the PushFlexMessage class with the messaging API client and destination ID, then calls register to add the tool to the MCP server.
    new PushFlexMessage(messagingApiClient, destinationId).register(server);
  • Zod schema for the userId parameter, with default value from destinationId and description.
    const userIdSchema = z
      .string()
      .default(this.destinationId)
      .describe(
        "The user ID to receive a message. Defaults to DESTINATION_USER_ID.",
      );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks critical behavioral details. It doesn't disclose whether this requires specific permissions, rate limits, delivery guarantees, error conditions, or what happens if the user ID is invalid. The description mentions customization but doesn't explain constraints or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences that are front-loaded with the core purpose and efficiently detail the supported layouts. Every word contributes to understanding the tool's functionality without redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool (pushing messages) with no annotations, no output schema, and incomplete parameter documentation, the description is inadequate. It doesn't address behavioral aspects like authentication needs, error handling, or response format, leaving significant gaps for an AI agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 50% (only 'message.contents.type' has a description). The description adds value by explaining bubble vs. carousel layouts, which clarifies the enum values, but doesn't cover other parameters like userId or altText. It partially compensates for the schema gap but leaves key parameters undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Push'), resource ('flex message'), target ('to a user via LINE'), and key capabilities ('highly customizable', 'supports both bubble and carousel layouts'). It distinguishes from sibling tools like push_text_message by specifying the message type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives like push_text_message, push_gemini_flex, or broadcast_flex_message. The description implies usage for flex messages but doesn't provide context about prerequisites, limitations, or comparison with siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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