push_messages
Send text or flexible messages to LINE users through the LINE Bot MCP Server, enabling communication via the LINE Messaging API.
Instructions
Push one or more LINE messages to a user (generic).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | No | User ID to receive messages. Defaults to DESTINATION_USER_ID | U1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p |
| messages | Yes | Array of LINE messages (text/flex) |
Implementation Reference
- src/tools/pushMessages.ts:41-54 (handler)The async handler function that executes the 'push_messages' tool logic, validating userId and pushing messages to LINE via the messaging API client, handling errors appropriately.async ({ userId, messages }) => { if (!userId) return createErrorResponse(NO_USER_ID_ERROR); try { const resp = await this.client.pushMessage({ to: userId, messages: messages as unknown as messagingApi.Message[], }); return createSuccessResponse(resp); } catch (e: any) { return createErrorResponse( `Failed to push messages: ${e?.message || e}`, ); } },
- src/tools/pushMessages.ts:27-36 (schema)Zod input schema definitions for the tool parameters: userId (optional string defaulting to destinationId) and messages (non-empty array of lineMessageSchema).register(server: McpServer) { const userId = z .string() .default(this.destinationId) .describe("User ID to receive messages. Defaults to DESTINATION_USER_ID"); const messages = z .array(lineMessageSchema) .min(1) .describe("Array of LINE messages (text/flex)");
- src/tools/pushMessages.ts:13-15 (schema)Zod schema union for LINE message types, accepting textMessageSchema, flexMessageSchema, or any.const lineMessageSchema = z .union([textMessageSchema, flexMessageSchema]) .or(z.any());
- src/index.ts:74-74 (registration)Main application registration: creates a new PushMessages instance with the LINE messaging API client and destination user ID, then calls register on the MCP server.new PushMessages(messagingApiClient, destinationId).register(server);