Agent App registered as an MCP server: every tools/call fails
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 58/100
調査の方向性
Start in api/core/mcp/server/streamable_http.py and trace handle_mcp_request, process_mapping_response, and extract_structured_output for AppMode.AGENT. Compare the Agent App stream in AgentAppRunner._publish_terminal_answer with legacy agent-chat events, then verify tools/call returns the persisted answer, structuredContent, and errors for failed runs without changing existing agent-chat results.
索引モデルが issue の本文から書いたものです。
説明
What happens
An Agent App (AppMode.AGENT, the app type backed by an Agent Soul) can be published as an MCP server from the console. tools/list works and returns the tool, but every tools/call fails. The client receives:
{"jsonrpc": "2.0", "id": 1, "error": {"code": -32602, "message": "Agent App only supports streaming mode"}}
Steps to reproduce
- Create and publish an Agent App.
- Register it as an MCP server. The console endpoint (
api/controllers/console/app/mcp_server.py) has no app-mode filter, so Agent Apps are accepted. - Call the tool from any MCP client.
Where it comes from
api/core/mcp/server/streamable_http.py never requests a streaming run for this mode:
streaming=app.mode == AppMode.AGENT_CHAT,
Agent Apps reject blocking generation (api/core/app/apps/agent_app/app_generator.py:89), so the call stops there.
Streaming mode alone is not enough
The stream parser only accumulates agent_thought events. Agent Apps publish their answer on the chat message channel instead (AgentAppRunner._publish_terminal_answer -> publish_text_answer -> QueueLLMChunkEvent), so just enabling streaming produces a successful tool result with an empty answer, which is worse than a visible error. Two details matter for whoever picks this up:
- Agent App
agent_messageevents carry in-progress stream text that can differ from the terminal answer, and theiragent_thoughtrows hold reasoning, so neither channel is the answer. - Legacy agent-chat sends the same text through both
agent_thoughtandagent_message. Accumulating both by event name doubles every existing agent-chat answer.
extract_structured_output and process_mapping_response in the same file also have no AppMode.AGENT arm: the former returns None (so 2025-06-18 clients get no structuredContent), the latter raises ValueError: Invalid app mode: agent.
Executed evidence
Probing the module's public entry points on main (fea6b6e9), no server needed:
1) process_mapping_response(app, {'answer': ...})
-> ValueError: Invalid app mode: agent
2) extract_structured_output(app, {'answer': 'hi'}, 'hi')
-> None
3) answer extracted from a real Agent App stream
-> answer=''
4) AgentAppGenerator.generate(streaming=False)
-> AgentAppGeneratorError: Agent App only supports streaming mode
5) tools/call through handle_mcp_request
-> {'jsonrpc': '2.0', 'id': 1, 'error': {'code': -32602, 'message': 'Agent App only supports streaming mode'}}
Probe 3 feeds the real SSE shape the app emits (agent_message deltas plus a terminal message chunk) and shows the answer would be empty even once streaming is enabled.
Expected behavior
tools/call returns the answer the app itself persists for the message, plus structuredContent for 2025-06-18 clients. A failed run should reach the client as an error rather than as an empty successful result.
- 主要言語
- TypeScript
- スター
- 157k
- フォーク
- 24.7k
- 平均マージ
- 22時間 32分
- マージ済み PR(30日)
- 611
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
langgenius/dify のほかの issue
-
Annotation Reply: a stored score threshold of 0.0 is silently replaced with 1, disabling the feature オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
langgenius/dify#42639 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
langgenius/dify#42468 · コメント 1 件 · リアクション 1 件 ·
-
🐞 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
langgenius/dify#42446 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
langgenius/dify#42355 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
langgenius/dify#42350 · コメント 1 件 · リアクション 1 件 ·
langgenius/dify の issue をすべて見る
似ている issue
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Automattic/studio#4908 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100