push_text_message
Send plain text messages to LINE users through the LINE Messaging API. Use this tool to deliver unformatted text content directly to specific user accounts.
Instructions
Push a simple text message to a user via LINE. Use this for sending plain text messages without formatting.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | ||
| userId | No | The user ID to receive a message. Defaults to DESTINATION_USER_ID. | U1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p |
Implementation Reference
- src/tools/pushTextMessage.ts:37-53 (handler)The core execution logic of the tool: sends a text message to the specified LINE user ID using the bot SDK's pushMessage method, with validation and 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 message: ${error.message}`, ); } },
- src/common/schema/textMessage.ts:3-9 (schema)Zod schema for the message parameter: requires 'type: "text"' and 'text' field up to 5000 characters.export const textMessageSchema = z.object({ type: z.literal("text").default("text"), text: z .string() .max(5000) .describe("The plain text content to send to the user."), });
- src/tools/pushTextMessage.ts:30-54 (registration)Registers the tool on the MCP server, specifying name, description, input schema (userId and message), and the handler function.server.tool( "push_text_message", "Push a simple text message to a user via LINE. Use this for sending plain text messages without formatting.", { userId: userIdSchema, message: textMessageSchema, }, 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 message: ${error.message}`, ); } }, );
- src/index.ts:61-61 (registration)Instantiates the PushTextMessage class with the messaging client and destination ID, then calls register to add the tool to the main MCP server.new PushTextMessage(messagingApiClient, destinationId).register(server);