feat(bridge): wrap get_pending_status as Claude Code UserPromptSubmit decision JSON#216
Merged
liplus-lin-lay merged 1 commit intoApr 25, 2026
Conversation
… decision JSON
`type: "mcp_tool"` UserPromptSubmit hook では、tool が返した text content が
JSON parse 成功 かつ decision schema に一致する場合のみ AI 文脈 (additionalContext)
に注入される。現状の `get_pending_status` は generic JSON
`{pending_count, types, latest_received_at}` を返すため parse は通るが
decision schema にマッチせず silent discard されており、`LI_PLUS_WEBHOOK_DELIVERY=mcp_hook`
モード (PR Liplus-Project/liplus-language#1164) で AI が webhook の存在に気づけない。
Local bridge 側で `get_pending_status` の戻り値を Claude Code docs literal の
canonical shape (`hookSpecificOutput.hookEventName="UserPromptSubmit"` +
`additionalContext` に pending_count / types / latest_received_at の自然文要約)
にラップする。Cloudflare Worker / DO 側は変更不要。`decision: "block"` は付けない。
手動 tool 呼び出し時も同 shape で返るが、AI は decision JSON を読めるため致命的影響はない。
他 MCP client (Codex / Cursor / Continue.dev) との互換性は本 issue 起案時点で
未実証 (可能性レベルの懸念)。
Closes #215
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
github-webhook-mcp | 7e0331c | Apr 25 2026, 01:51 PM |
liplus-lin-lay
commented
Apr 25, 2026
Member
Author
liplus-lin-lay
left a comment
There was a problem hiding this comment.
AI 自己レビュー (auto mode)
仕様適合
- #215 の constraints をすべて満たしている (Worker 側不変 /
decision:"block"不付与 /hookEventName="UserPromptSubmit"/additionalContext自然文要約) - 改変箇所は
setRequestHandler(CallToolRequestSchema, ...)のname === "get_pending_status"分岐 + 新規 helper 2 関数のみ。他 tool は無影響
テスト
- 既存 18 + 新規 5 = 23 ケース pass
- 新規ケースは正常 (zero / non-zero) / parse 失敗 / content 欠如 / 非テキストの 5 ライン
- 既存 test と同じインライン mirror 規約に準拠
自己リスク申告
- 互換性: 手動 tool 呼び出し時も decision shape で返るため、Claude Code 以外の MCP client が
pending_countキーを直接参照する実装をしていた場合は破壊的変更。社内の既知利用者は Claude Code のみ。 additionalContext長: 成功 parse 時は長さキャップ無し。types が多い場合 100 文字目安を超え得るが、additionalContext自体に上限は無く影響なしと判断。- docs F3.1 の追記は ja / en 両方反映済み (Wiki sync は merge 後の release procedure で吸収)。
判定
auto mode self-review 承認。 gh pr merge --squash で進める。
This was referenced Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
type: "mcp_tool"UserPromptSubmit hook では、tool が返した text content が JSON parse に成功し、かつ decision schema に一致する場合のみ AI 文脈 (additionalContext) に注入される。現状のget_pending_statusは generic JSON{pending_count, types, latest_received_at}を返すため parse は通るが decision schema にマッチせず silent discard される。Liplus-Project/liplus-language#1164 で導入した
LI_PLUS_WEBHOOK_DELIVERY=mcp_hookモードでは、この silent discard により AI が webhook の存在に気づけない事象が実機検証 (2026-04-25, Claude Code 2.1.119) で確認されている (詳細: Liplus-Project/liplus-language#1167)。変更内容
Local bridge (
mcp-server/server/index.js) のCallToolRequestSchemahandler でname === "get_pending_status"を special-case し、戻り値を Claude Code docs literal の canonical decision shape にラップする:```json
{
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"additionalContext": "<pending_count / types / latest_received_at の自然文要約 ~100 chars>"
}
}
```
decision: "block"は付けない (prompt がブロックされるため)影響範囲
mcp-server/server/index.js(新規 helper 2 関数 + 1 行 dispatch)mcp-server/test/get-pending-status-decision-shape.test.mjs(新規, 5 ケース)docs/0-requirements.md/docs/0-requirements.ja.md(F3.1 にローカルブリッジ整形の節を追加)テスト
`npm test` (mcp-server/) で既存 18 ケース + 新規 5 ケース、計 23 ケース pass。
既知の未実証事項
他 MCP client (Codex / Cursor / Continue.dev など) で
get_pending_statusを呼び出した際の互換性影響は本 PR 時点で実証していない (可能性レベルの懸念)。Claude Code 以外でget_pending_statusを生で読んでいた利用例は社内には現存しない。関連
mcp_hookモード設計矛盾)