push_text_message
Send plain text messages to LINE users through the LINE Bot MCP Server. This tool enables AI agents to deliver text content directly to specified user IDs without formatting.
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 |
|---|---|---|---|
| userId | No | The user ID to receive a message. Defaults to DESTINATION_USER_ID. | U1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p |
| message | Yes |
Implementation Reference
- src/tools/pushTextMessage.ts:37-53 (handler)The core handler function that sends a text message to a LINE user using the messaging API client. It checks for userId, pushes the message, and handles errors with standardized responses.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/tools/pushTextMessage.ts:33-36 (schema)Input schema for the push_text_message tool, consisting of userId (string, default destinationId) and message (textMessageSchema).{ userId: userIdSchema, message: textMessageSchema, },
- src/common/schema/textMessage.ts:3-9 (schema)Zod schema defining the structure of a LINE text message: type 'text' and text string up to 5000 chars.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:22-55 (registration)The register method in PushTextMessage class that registers the tool on the MCP server, including name, description, schema, and handler.register(server: McpServer) { const userIdSchema = z .string() .default(this.destinationId) .describe( "The user ID to receive a message. Defaults to DESTINATION_USER_ID.", ); 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)Instantiation of PushTextMessage tool with LINE client and destination ID, and registration on the MCP server.new PushTextMessage(messagingApiClient, destinationId).register(server);