@funny-booth/langley-video-mcp 0.10.0 → 0.11.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/client.js CHANGED
@@ -14,7 +14,13 @@ export const DEFAULT_API_URL = "https://langley.funny-booth.jp/video-agent-api";
14
14
  const base = () => (process.env.LANGLEY_VIDEO_API_URL ?? DEFAULT_API_URL).replace(/\/$/, "");
15
15
  export const NO_TOKEN_MESSAGE = "Langley-AgentOS のログインの証明(TOOL_TOKEN)がありません。Langley-AgentOS から起動し直してください";
16
16
  export class AgentError extends Error {
17
+ status;
18
+ constructor(message, status) {
19
+ super(message);
20
+ this.status = status;
21
+ }
17
22
  }
23
+ export const UNKNOWN_RESULT_MESSAGE = "記録されたか不明です。送り直さず、video_my_requests の一覧で確かめてください";
18
24
  /** サーバーの文言をそのまま返す(言い換えない)。文言が無ければ状態コードを伝える */
19
25
  export function explain(status, body) {
20
26
  return typeof body === "object" && body !== null && typeof body.error === "string"
@@ -44,7 +50,7 @@ async function call(path, token, init = {}, f = fetch) {
44
50
  catch {
45
51
  /* 本文が JSON でないときは状態コードだけで説明する */
46
52
  }
47
- throw new AgentError(explain(res.status, body));
53
+ throw new AgentError(explain(res.status, body), res.status);
48
54
  }
49
55
  return res;
50
56
  }
@@ -72,10 +78,27 @@ export const CHANGE_AREAS = ["storyboard", "approval_page", "slack", "video", "m
72
78
  export const CHANGE_URGENCIES = ["today", "this_week", "whenever"];
73
79
  /** 仕組みの改修を依頼する(受け付けて記録するだけ。仕組みはすぐには変わらない) */
74
80
  export async function requestChange(token, body, f = fetch) {
75
- const res = await call("/change-requests", token, {
81
+ // 返事が来なければ、届いたかどうかは分からない。失敗と言い切らない(送り直しによる二重の依頼を防ぐ)
82
+ try {
83
+ const res = await call("/change-requests", token, {
84
+ method: "POST",
85
+ headers: { "Content-Type": "application/json" },
86
+ body: JSON.stringify(body),
87
+ }, f);
88
+ return (await res.json());
89
+ }
90
+ catch (e) {
91
+ if (e instanceof AgentError && (e.status === undefined || e.status < 500))
92
+ throw e;
93
+ throw new AgentError(UNKNOWN_RESULT_MESSAGE);
94
+ }
95
+ }
96
+ /** 受付のうちの自分の依頼を取り下げる */
97
+ export async function withdrawChange(token, id, f = fetch) {
98
+ const res = await call("/change-requests/withdraw", token, {
76
99
  method: "POST",
77
100
  headers: { "Content-Type": "application/json" },
78
- body: JSON.stringify(body),
101
+ body: JSON.stringify({ id }),
79
102
  }, f);
80
103
  return (await res.json());
81
104
  }
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
7
7
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
8
8
  import { z } from "zod";
9
- import { AgentError, CHANGE_AREAS, CHANGE_URGENCIES, appeals, delivery, myRequests, planAct, planStart, planStatus, productions, request, requestChange } from "./client.js";
9
+ import { withdrawChange, AgentError, CHANGE_AREAS, CHANGE_URGENCIES, appeals, delivery, myRequests, planAct, planStart, planStatus, productions, request, requestChange } from "./client.js";
10
10
  // agent-core は CommonJS なので、名前つきの import では起動のときに落ちる(default から取る)
11
11
  import portalClient from "@funny-booth/agent-core/dist/portalClient.js";
12
12
  const portal = portalClient.portalClientFromEnv(); // PORTAL_URL・TOOL_TOKEN が無ければ null
@@ -16,7 +16,7 @@ const fail = (e) => ({
16
16
  content: [{ type: "text", text: e instanceof AgentError ? e.message : `動画の受け口につながりません: ${String(e)}` }],
17
17
  isError: true,
18
18
  });
19
- const server = new McpServer({ name: "langley-video", version: "0.10.0" });
19
+ const server = new McpServer({ name: "langley-video", version: "0.11.0" });
20
20
  server.registerTool("video_productions", {
21
21
  description: "ラングレー動画の制作の一覧(新しい順)。どの動画がどの段階か(絵コンテ承認待ち・最終確認待ち・納品できる)と、承認画面のリンクを返す",
22
22
  inputSchema: {},
@@ -92,7 +92,7 @@ server.registerTool("video_plan_start", {
92
92
  inputSchema: {
93
93
  sku: z.string().describe("商品の名前(例: ブラトップ・ヒートインナー)"),
94
94
  wish: z.string().min(1).max(2000).optional().describe("依頼した人の文章(そのまま・要約しない)"),
95
- references: z.array(z.string().url()).max(5).optional().describe("参考の広告の動画の URL(1本目の音声を文字に起こし、役割に分けて参考にする)"),
95
+ references: z.array(z.string().url()).max(5).optional().describe("参考の広告の動画の URL(1本目の音声と画面の文字を読み取り、役割に分けて参考にする。声がほとんど無い動画は画面の文字=テロップを読む)"),
96
96
  direction: z.string().max(2000).optional().describe("方向性(広告の相談で決まった、何を作るか・季節や行事)"),
97
97
  brief: z.string().max(8000).optional().describe("クリエイティブブリーフ(広告の相談で平山様と決めたことの全文・Markdown・要約しない)"),
98
98
  },
@@ -177,27 +177,44 @@ server.registerTool("video_delivery", {
177
177
  }
178
178
  });
179
179
  server.registerTool("video_request_change", {
180
- description: "動画の仕組み(絵コンテ・承認画面・Slack の知らせ・完成した動画・素材選び・エージェント)の改修を依頼する。" +
180
+ description: "動画の仕組み(台本づくり・絵コンテ・承認画面・Slack の知らせ・完成した動画・素材選び・エージェント)の改修を依頼する。" +
181
181
  "仕組みはすぐには変わらない(担当が改修し、確かめてから反映する)。改修の相談のエージェント(@動画改修)を許可された人だけが使える",
182
182
  inputSchema: {
183
- area: z.enum(CHANGE_AREAS).describe("storyboard=絵コンテ(台本・テロップ・ナレーション・カットの選び方)/ approval_page=承認画面 / slack=Slack の知らせ / video=完成した動画・納品セット / materials=素材選び・素材の範囲 / agent=エージェント / other=その他"),
183
+ area: z.enum(CHANGE_AREAS).describe("storyboard=台本づくり・絵コンテ(台本・テロップ・ナレーション・カットの選び方)/ approval_page=承認画面 / slack=Slack の知らせ / video=完成した動画・納品セット / materials=素材選び・素材の範囲 / agent=エージェント / other=その他"),
184
184
  summary: z.string().min(1).max(200).describe("1行の要約"),
185
185
  want: z.string().min(1).max(2000).describe("どう変わってほしいか(見え方・例を含めて)"),
186
186
  current: z.string().min(1).max(1000).optional().describe("今どうなっているか(確かめた事実)"),
187
187
  why: z.string().min(1).max(1000).optional().describe("なぜ変えたいか"),
188
188
  urgency: z.enum(CHANGE_URGENCIES).describe("today=今日中 / this_week=今週中 / whenever=いつでも"),
189
+ consentQuote: z.string().min(1).max(200).describe("復唱を見たあとの、本人の返事の原文(言い換えない)"),
189
190
  },
190
191
  }, async (args) => {
191
192
  try {
192
193
  const r = await requestChange(token(), args);
193
- return text(`受け付けました。受付番号: ${r.id}(状態: ${r.review_status})`);
194
+ return text(r.duplicate
195
+ ? `同じ内容の依頼をすでに受け付けています。二重には依頼していません。受付番号: ${r.id}(状態: ${r.review_status})`
196
+ : `受け付けました。受付番号: ${r.id}(状態: ${r.review_status})`);
197
+ }
198
+ catch (e) {
199
+ return fail(e);
200
+ }
201
+ });
202
+ server.registerTool("video_withdraw_request", {
203
+ description: "自分の改修の依頼を取り下げる。受付(pending)のうちだけできる。本人がはっきり頼んだときだけ使う",
204
+ inputSchema: {
205
+ id: z.string().min(1).describe("受付番号(video_my_requests の id)"),
206
+ },
207
+ }, async ({ id }) => {
208
+ try {
209
+ const r = await withdrawChange(token(), id);
210
+ return text(`取り下げました。受付番号: ${r.id}(状態: ${r.review_status})`);
194
211
  }
195
212
  catch (e) {
196
213
  return fail(e);
197
214
  }
198
215
  });
199
216
  server.registerTool("video_my_requests", {
200
- description: "自分が出した改修の依頼の進み具合(新しい順に20件まで)。review_status は pending=受付 / in_progress=対応中 / done=反映済み / declined=見送り / needs_info=情報が足りない。note は担当からの説明",
217
+ description: "自分が出した改修の依頼の進み具合(新しい順に20件まで)。review_status は pending=受付 / in_progress=対応中 / done=反映済み / declined=見送り / needs_info=情報が足りない / withdrawn=本人が取り下げ。note は担当からの説明",
201
218
  inputSchema: {},
202
219
  }, async () => {
203
220
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funny-booth/langley-video-mcp",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "type": "module",
5
5
  "description": "ラングレー動画の制作の状況・制作の依頼・納品セットの取得(Langley-AgentOS の「WEBマーケクリエイティブ」から使う MCP・stdio)",
6
6
  "publishConfig": {