-
Notifications
You must be signed in to change notification settings - Fork 85
Add rich menu apis #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rich menu apis #97
Conversation
| server.tool( | ||
| "get_rich_menu_list", | ||
| "Get the list of rich menus associated with your LINE Official Account.", | ||
| {}, | ||
| async () => { | ||
| try { | ||
| const response = await messagingApiClient.getRichMenuList(); | ||
| return createSuccessResponse(response); | ||
| } catch (error) { | ||
| return createErrorResponse( | ||
| `Failed to broadcast message: ${error.message}`, | ||
| ); | ||
| } | ||
| }, | ||
| ); | ||
|
|
||
| server.tool( | ||
| "delete_rich_menu", | ||
| "Delete a rich menu from your LINE Official Account.", | ||
| { | ||
| richMenuId: z.string().describe("The ID of the rich menu to delete."), | ||
| }, | ||
| async ({ richMenuId }) => { | ||
| try { | ||
| const response = await messagingApiClient.deleteRichMenu(richMenuId); | ||
| return createSuccessResponse(response); | ||
| } catch (error) { | ||
| return createErrorResponse( | ||
| `Failed to delete rich menu: ${error.message}`, | ||
| ); | ||
| } | ||
| }, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/index.ts
Outdated
| ); | ||
| } | ||
| }, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Hmm, I'm not sure about the best practice for passing images to the MCP Server...
I tried verifying whether we could pass images through chat from AI agents like Claude by changing the tool argument from a path to base64, but I ran into character limits. (like this)
With the method you implemented, we need to prepare images in advance within the local mcp-server repository, but maybe this approach will not work with the npx installation method (though I can't think of any better alternatives...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command needs to be discussed further. Therefore, I will separate the PR.
| const response = await messagingApiClient.setDefaultRichMenu(richMenuId); | ||
| return createSuccessResponse(response); | ||
| }, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const response = await messagingApiClient.cancelDefaultRichMenu(); | ||
| return createSuccessResponse(response); | ||
| }, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eucyt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This comment is not related to this PR directly)
I believe the createRichMenu tool would be in higher demand than the *Aliace tools. This is because you need to create a rich menu first before setting images.
src/index.ts
Outdated
| import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; | ||
| import * as line from "@line/bot-sdk"; | ||
| import { z } from "zod"; | ||
| import pkg from "../package.json" with { type: "json" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax is not available in Node v20.9 or earlier...
Instead, use ./version.js, so this import is unnecessary.
Related to #61
src/index.ts
Outdated
| const lineBlobClient = new line.messagingApi.MessagingApiBlobClient({ | ||
| channelAccessToken: channelAccessToken, | ||
| defaultHeaders: { | ||
| "User-Agent": `${pkg.name}/${pkg.version}`, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const lineBlobClient = new line.messagingApi.MessagingApiBlobClient({ | |
| channelAccessToken: channelAccessToken, | |
| defaultHeaders: { | |
| "User-Agent": `${pkg.name}/${pkg.version}`, | |
| }, | |
| }); | |
| const lineBlobClient = new line.messagingApi.MessagingApiBlobClient({ | |
| channelAccessToken: channelAccessToken, | |
| defaultHeaders: { | |
| "User-Agent": USER_AGENT, | |
| }, | |
| }); |
Please use ./version.js as shown 🙏
Related to #61
src/index.ts
Outdated
| ); | ||
| } | ||
| }, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Hmm, I'm not sure about the best practice for passing images to the MCP Server...
I tried verifying whether we could pass images through chat from AI agents like Claude by changing the tool argument from a path to base64, but I ran into character limits. (like this)
With the method you implemented, we need to prepare images in advance within the local mcp-server repository, but maybe this approach will not work with the npx installation method (though I can't think of any better alternatives...).
54abac3 to
595c7fd
Compare
eucyt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!




Hello! This is 4geru.
MCP is a helpful tool for development.
I'm planning to add some rich menu APIs on MCP.
This is a 1st PR for rich menu.
added in this PR
planning in other PR
Related to development APIs
not planning in other PR
Not related to development APIs