@line-harness/mcp-server 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -2
- package/package.json +2 -2
- package/src/tools/create-rich-menu.ts +15 -2
package/dist/index.js
CHANGED
|
@@ -725,7 +725,7 @@ import { z as z8 } from "zod";
|
|
|
725
725
|
function registerCreateRichMenu(server2) {
|
|
726
726
|
server2.tool(
|
|
727
727
|
"create_rich_menu",
|
|
728
|
-
"Create a LINE rich menu
|
|
728
|
+
"Create a LINE rich menu with optional image upload. Provide imageData (base64) to attach the menu image in one step.",
|
|
729
729
|
{
|
|
730
730
|
name: z8.string().describe("Rich menu name"),
|
|
731
731
|
chatBarText: z8.string().default("\u30E1\u30CB\u30E5\u30FC").describe("Text shown on the chat bar button"),
|
|
@@ -737,9 +737,11 @@ function registerCreateRichMenu(server2) {
|
|
|
737
737
|
areas: z8.string().describe(
|
|
738
738
|
"JSON string of menu button areas. Format: [{ bounds: { x, y, width, height }, action: { type: 'uri'|'message'|'postback', uri?, text?, data? } }]"
|
|
739
739
|
),
|
|
740
|
+
imageData: z8.string().optional().describe("Base64-encoded image data for the rich menu (PNG or JPEG, 2500x1686 or 2500x843)"),
|
|
741
|
+
imageContentType: z8.enum(["image/png", "image/jpeg"]).default("image/jpeg").describe("Image MIME type"),
|
|
740
742
|
setAsDefault: z8.boolean().default(false).describe("Set this as the default rich menu for all friends")
|
|
741
743
|
},
|
|
742
|
-
async ({ name, chatBarText, size, selected, areas, setAsDefault }) => {
|
|
744
|
+
async ({ name, chatBarText, size, selected, areas, imageData, imageContentType, setAsDefault }) => {
|
|
743
745
|
try {
|
|
744
746
|
const client = getClient();
|
|
745
747
|
const menu = await client.richMenus.create({
|
|
@@ -749,6 +751,9 @@ function registerCreateRichMenu(server2) {
|
|
|
749
751
|
selected,
|
|
750
752
|
areas: JSON.parse(areas)
|
|
751
753
|
});
|
|
754
|
+
if (imageData) {
|
|
755
|
+
await client.richMenus.uploadImage(menu.richMenuId, imageData, imageContentType);
|
|
756
|
+
}
|
|
752
757
|
if (setAsDefault) {
|
|
753
758
|
await client.richMenus.setDefault(menu.richMenuId);
|
|
754
759
|
}
|
|
@@ -760,6 +765,7 @@ function registerCreateRichMenu(server2) {
|
|
|
760
765
|
{
|
|
761
766
|
success: true,
|
|
762
767
|
richMenuId: menu.richMenuId,
|
|
768
|
+
imageUploaded: !!imageData,
|
|
763
769
|
isDefault: setAsDefault
|
|
764
770
|
},
|
|
765
771
|
null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@line-harness/mcp-server",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"line-harness-mcp": "./dist/index.js"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
11
11
|
"zod": "^3.24.4",
|
|
12
|
-
"@line-harness/sdk": "0.2.
|
|
12
|
+
"@line-harness/sdk": "0.2.5"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"tsup": "^8.4.0",
|
|
@@ -5,7 +5,7 @@ import { getClient } from "../client.js";
|
|
|
5
5
|
export function registerCreateRichMenu(server: McpServer): void {
|
|
6
6
|
server.tool(
|
|
7
7
|
"create_rich_menu",
|
|
8
|
-
"Create a LINE rich menu
|
|
8
|
+
"Create a LINE rich menu with optional image upload. Provide imageData (base64) to attach the menu image in one step.",
|
|
9
9
|
{
|
|
10
10
|
name: z.string().describe("Rich menu name"),
|
|
11
11
|
chatBarText: z
|
|
@@ -34,12 +34,20 @@ export function registerCreateRichMenu(server: McpServer): void {
|
|
|
34
34
|
.describe(
|
|
35
35
|
"JSON string of menu button areas. Format: [{ bounds: { x, y, width, height }, action: { type: 'uri'|'message'|'postback', uri?, text?, data? } }]",
|
|
36
36
|
),
|
|
37
|
+
imageData: z
|
|
38
|
+
.string()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe("Base64-encoded image data for the rich menu (PNG or JPEG, 2500x1686 or 2500x843)"),
|
|
41
|
+
imageContentType: z
|
|
42
|
+
.enum(["image/png", "image/jpeg"])
|
|
43
|
+
.default("image/jpeg")
|
|
44
|
+
.describe("Image MIME type"),
|
|
37
45
|
setAsDefault: z
|
|
38
46
|
.boolean()
|
|
39
47
|
.default(false)
|
|
40
48
|
.describe("Set this as the default rich menu for all friends"),
|
|
41
49
|
},
|
|
42
|
-
async ({ name, chatBarText, size, selected, areas, setAsDefault }) => {
|
|
50
|
+
async ({ name, chatBarText, size, selected, areas, imageData, imageContentType, setAsDefault }) => {
|
|
43
51
|
try {
|
|
44
52
|
const client = getClient();
|
|
45
53
|
const menu = await client.richMenus.create({
|
|
@@ -50,6 +58,10 @@ export function registerCreateRichMenu(server: McpServer): void {
|
|
|
50
58
|
areas: JSON.parse(areas),
|
|
51
59
|
});
|
|
52
60
|
|
|
61
|
+
if (imageData) {
|
|
62
|
+
await client.richMenus.uploadImage(menu.richMenuId, imageData, imageContentType);
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
if (setAsDefault) {
|
|
54
66
|
await client.richMenus.setDefault(menu.richMenuId);
|
|
55
67
|
}
|
|
@@ -62,6 +74,7 @@ export function registerCreateRichMenu(server: McpServer): void {
|
|
|
62
74
|
{
|
|
63
75
|
success: true,
|
|
64
76
|
richMenuId: menu.richMenuId,
|
|
77
|
+
imageUploaded: !!imageData,
|
|
65
78
|
isDefault: setAsDefault,
|
|
66
79
|
},
|
|
67
80
|
null,
|