@funny-booth/langley-video-mcp 0.6.0 → 0.7.0
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/client.js +17 -0
- package/dist/index.js +81 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -95,3 +95,20 @@ export async function delivery(token, name, dir = join(homedir(), "Downloads"),
|
|
|
95
95
|
await rename(part, file);
|
|
96
96
|
return file;
|
|
97
97
|
}
|
|
98
|
+
async function post(path, token, body, f) {
|
|
99
|
+
const res = await call(path, token, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) }, f);
|
|
100
|
+
return (await res.json());
|
|
101
|
+
}
|
|
102
|
+
/** 台本づくりを始める。シナリオの案を作り始める(数分かかる) */
|
|
103
|
+
export function planStart(token, body, f = fetch) {
|
|
104
|
+
return post("/plan", token, body, f);
|
|
105
|
+
}
|
|
106
|
+
/** 今の段の案を、シートの「修正」の欄と会話の言葉(note)で直す / 作り直す */
|
|
107
|
+
export function planAct(token, action, body, f = fetch) {
|
|
108
|
+
return post(`/plan/${action}`, token, body, f);
|
|
109
|
+
}
|
|
110
|
+
export async function planStatus(token, id, f = fetch) {
|
|
111
|
+
if (id)
|
|
112
|
+
return [(await (await call(`/plan?id=${encodeURIComponent(id)}`, token, {}, f)).json())];
|
|
113
|
+
return (await (await call("/plans", token, {}, f)).json()).plans;
|
|
114
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
6
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
import { AgentError, CHANGE_AREAS, CHANGE_URGENCIES, appeals, delivery, myRequests, productions, request, requestChange } from "./client.js";
|
|
8
|
+
import { AgentError, CHANGE_AREAS, CHANGE_URGENCIES, appeals, delivery, myRequests, planAct, planStart, planStatus, productions, request, requestChange } from "./client.js";
|
|
9
9
|
const token = () => process.env.TOOL_TOKEN;
|
|
10
10
|
const text = (t) => ({ content: [{ type: "text", text: t }] });
|
|
11
11
|
const fail = (e) => ({
|
|
12
12
|
content: [{ type: "text", text: e instanceof AgentError ? e.message : `動画の受け口につながりません: ${String(e)}` }],
|
|
13
13
|
isError: true,
|
|
14
14
|
});
|
|
15
|
-
const server = new McpServer({ name: "langley-video", version: "0.
|
|
15
|
+
const server = new McpServer({ name: "langley-video", version: "0.7.0" });
|
|
16
16
|
server.registerTool("video_productions", {
|
|
17
17
|
description: "ラングレー動画の制作の一覧(新しい順)。どの動画がどの段階か(絵コンテ承認待ち・最終確認待ち・納品できる)と、承認画面のリンクを返す",
|
|
18
18
|
inputSchema: {},
|
|
@@ -68,6 +68,85 @@ server.registerTool("video_request", {
|
|
|
68
68
|
return fail(e);
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
+
const planText = (p) => [
|
|
72
|
+
`台本づくり ${p.id}(${p.sku}): 今の段 ${p.stage_ja}${p.working ? "(いま案を作っています。数分後にもう一度確かめてください)" : ""}`,
|
|
73
|
+
...(p.error ? [`前回の案づくりが止まりました: ${p.error}`] : []),
|
|
74
|
+
...Object.entries(p.approved).map(([, a]) => `OK 済み: ${a.summary}(${a.who})`),
|
|
75
|
+
...(p.latest ? [`最新の案: シート「${p.latest.tab}」(第${p.latest.version}版)`, ...p.latest.summary.map((s) => ` ${s}`)] : []),
|
|
76
|
+
...(p.productions.length ? [`制作に渡しました: ${p.productions.join("、")}`] : []),
|
|
77
|
+
`台本のシート: ${p.sheet}`,
|
|
78
|
+
].join("\n");
|
|
79
|
+
server.registerTool("video_plan_start", {
|
|
80
|
+
description: "台本づくりを始める(シナリオ → 構成 → 台本 を、段ごとに平山様の OK をもらって進める。台本の OK の後に制作が始まる)。" +
|
|
81
|
+
"まずシナリオの案(3つ)を作り、台本のシート(Google スプレッドシート)に書き出す。数分かかるので、video_plan_status で確かめる。" +
|
|
82
|
+
"依頼の文章(wish)はそのまま渡す。方向性(direction)は広告の相談で決まったこと",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
sku: z.string().describe("商品の名前(例: ブラトップ・ヒートインナー)"),
|
|
85
|
+
wish: z.string().min(1).max(2000).optional().describe("依頼した人の文章(そのまま・要約しない)"),
|
|
86
|
+
references: z.array(z.string().url()).max(5).optional().describe("参考の広告の動画の URL(1本目の音声を文字に起こし、役割に分けて参考にする)"),
|
|
87
|
+
direction: z.string().max(2000).optional().describe("方向性(広告の相談で決まった、何を作るか・季節や行事)"),
|
|
88
|
+
},
|
|
89
|
+
}, async (args) => {
|
|
90
|
+
try {
|
|
91
|
+
const r = await planStart(token(), args);
|
|
92
|
+
return text(`${r.message}\n台本づくりの番号: ${r.id}\n台本のシート: ${r.sheet}`);
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
return fail(e);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
server.registerTool("video_plan_status", {
|
|
99
|
+
description: "台本づくりの様子(今の段・案づくりの途中か・最新の案の要点とシートの名前・OK 済みの段)。番号を渡さなければ新しい順に10件",
|
|
100
|
+
inputSchema: { id: z.string().optional().describe("台本づくりの番号(p で始まる)") },
|
|
101
|
+
}, async ({ id }) => {
|
|
102
|
+
try {
|
|
103
|
+
const list = await planStatus(token(), id);
|
|
104
|
+
return text(list.length ? list.map(planText).join("\n\n") : "台本づくりはまだありません");
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
return fail(e);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
server.registerTool("video_plan_revise", {
|
|
111
|
+
description: "今の段の案を直す。平山様がシートの「修正」の欄に書いたことと、会話で言われたこと(note・言葉のまま)を AI が読んで、" +
|
|
112
|
+
"直した案を新しい版としてシートに出す(前の版は残る)。数分かかる",
|
|
113
|
+
inputSchema: { id: z.string(), note: z.string().max(2000).optional().describe("会話で言われた直し(言葉のまま)") },
|
|
114
|
+
}, async ({ id, note }) => {
|
|
115
|
+
try {
|
|
116
|
+
return text((await planAct(token(), "revise", { id, note })).message);
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
return fail(e);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
server.registerTool("video_plan_redo", {
|
|
123
|
+
description: "今の段の案を、前の案とは違う方向で作り直す(平山様が「まるっと変えたい」と言ったとき)。note に理由を言葉のまま",
|
|
124
|
+
inputSchema: { id: z.string(), note: z.string().max(2000).optional() },
|
|
125
|
+
}, async ({ id, note }) => {
|
|
126
|
+
try {
|
|
127
|
+
return text((await planAct(token(), "redo", { id, note })).message);
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
return fail(e);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
server.registerTool("video_plan_approve", {
|
|
134
|
+
description: "今の段の最新の案に OK を出して次の段へ進む。平山様が会話ではっきり OK と言ったときだけ呼ぶ(あいまいなら聞き直す・あなたが判断して呼ばない)。" +
|
|
135
|
+
"シナリオは選んだ案の番号(choice)を渡す。台本の OK で、その台本のまま制作が始まる(絵コンテができたら Slack で知らせる)。OK を出せるのは平山様だけ",
|
|
136
|
+
inputSchema: {
|
|
137
|
+
id: z.string(),
|
|
138
|
+
choice: z.number().int().min(1).optional().describe("シナリオの段で、OK を出す案の番号"),
|
|
139
|
+
test: z.boolean().optional().describe("動作確認の試験のときだけ true(台本の OK で始まる制作に【試験】が付く)"),
|
|
140
|
+
},
|
|
141
|
+
}, async ({ id, choice, test }) => {
|
|
142
|
+
try {
|
|
143
|
+
const r = await planAct(token(), "approve", { id, choice, test: test === true });
|
|
144
|
+
return text(r.message + (r.productions?.length ? `\n制作名: ${r.productions.join("、")}` : ""));
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
return fail(e);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
71
150
|
server.registerTool("video_delivery", {
|
|
72
151
|
description: "最終確認(ゲート②)で承認された動画の納品セット(Premiere の編集データ・素材・テロップ一式)を、このパソコンのダウンロードフォルダに zip で保存する",
|
|
73
152
|
inputSchema: { name: z.string().describe("制作名(video_productions で分かる)") },
|