Skip to content

Commit f2262db

Browse files
authored
feat: add prompt instructions into tool docstring (#105)
* Optimize token efficiency by moving LLM instructions to tool docstring * Simplify user configuration by removing complex Cursor rules * Improve tool self-documentation following FastMCP best practices Co-authored-by: fireinice <[email protected]>
1 parent 6903314 commit f2262db

File tree

4 files changed

+24
-32
lines changed

4 files changed

+24
-32
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,7 @@ For optimal results, add the following rules to your AI assistant:
159159
```
160160
# MCP Interactive Feedback Rules
161161
162-
1. During any process, task, or conversation, whether asking, replying, or completing phased tasks, you must call MCP mcp-feedback-enhanced.
163-
2. Whenever user feedback is received, if the feedback content is not empty, you must call MCP mcp-feedback-enhanced again and adjust behavior based on the feedback content.
164-
3. Only when the user explicitly indicates "end" or "no more interaction needed" can you stop calling MCP mcp-feedback-enhanced, and the process is considered complete.
165-
4. Unless receiving termination instructions, all steps must repeatedly call MCP mcp-feedback-enhanced.
166-
5. Before completing tasks, you must use the MCP mcp-feedback-enhanced tool to ask users for feedback.
162+
follow mcp-feedback-enhanced instructions
167163
```
168164

169165
## ⚙️ Advanced Settings

README.zh-CN.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,7 @@ uvx mcp-feedback-enhanced@latest test
159159
```
160160
# MCP Interactive Feedback 规则
161161
162-
1. 在任何流程、任务、对话进行时,无论是询问、回复、或完成阶段性任务,皆必须调用 MCP mcp-feedback-enhanced。
163-
2. 每当收到用户反馈,若反馈内容非空,必须再次调用 MCP mcp-feedback-enhanced,并根据反馈内容调整行为。
164-
3. 仅当用户明确表示「结束」或「不再需要交互」时,才可停止调用 MCP mcp-feedback-enhanced,流程才算结束。
165-
4. 除非收到结束指令,否则所有步骤都必须重复调用 MCP mcp-feedback-enhanced。
166-
5. 完成任务前,必须使用 MCP mcp-feedback-enhanced 工具向用户询问反馈。
162+
注意根据mcp-feedback-enhanced工具的要求在任务完成前进行工具调用
167163
```
168164

169165
## ⚙️ 进阶设定

README.zh-TW.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,7 @@ uvx mcp-feedback-enhanced@latest test
159159
```
160160
# MCP Interactive Feedback 規則
161161
162-
1. 在任何流程、任務、對話進行時,無論是詢問、回覆、或完成階段性任務,皆必須呼叫 MCP mcp-feedback-enhanced。
163-
2. 每當收到使用者回饋,若回饋內容非空,必須再次呼叫 MCP mcp-feedback-enhanced,並根據回饋內容調整行為。
164-
3. 僅當使用者明確表示「結束」或「不再需要互動」時,才可停止呼叫 MCP mcp-feedback-enhanced,流程才算結束。
165-
4. 除非收到結束指令,否則所有步驟都必須重複呼叫 MCP mcp-feedback-enhanced。
166-
5. 完成任務前,必須使用 MCP mcp-feedback-enhanced 工具向使用者詢問回饋。
162+
註意根據mcp-feedback-enhanced 工具的要求在任務完成前進行工具調用
167163
```
168164

169165
## ⚙️ 進階設定

src/mcp_feedback_enhanced/server.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@
3737

3838
# 導入統一的調試功能
3939
from .debug import server_debug_log as debug_log
40-
4140
# 導入多語系支援
4241
# 導入錯誤處理框架
4342
from .utils.error_handler import ErrorHandler, ErrorType
44-
4543
# 導入資源管理器
4644
from .utils.resource_manager import create_temp_file
4745

@@ -116,7 +114,6 @@ def init_encoding():
116114
# 初始化 MCP 服務器
117115
from . import __version__
118116

119-
120117
# 確保 log_level 設定為正確的大寫格式
121118
fastmcp_settings = {}
122119

@@ -435,19 +432,11 @@ async def interactive_feedback(
435432
timeout: Annotated[int, Field(description="等待用戶回饋的超時時間(秒)")] = 600,
436433
) -> list:
437434
"""
438-
收集用戶的互動回饋,支援文字和圖片
439-
440-
此工具使用 Web UI 介面收集用戶回饋,支援智能環境檢測。
441-
442-
用戶可以:
443-
1. 執行命令來驗證結果
444-
2. 提供文字回饋
445-
3. 上傳圖片作為回饋
446-
4. 查看 AI 的工作摘要
447-
448-
調試模式:
449-
- 設置環境變數 MCP_DEBUG=true 可啟用詳細調試輸出
450-
- 生產環境建議關閉調試模式以避免輸出干擾
435+
1. During any process, task, or conversation, whether asking, replying, or completing phased tasks, you must call this tool to ask for feedback.
436+
2. Unless receiving termination instructions, all steps must repeatedly call this tool.
437+
3. Whenever user feedback is received, if the feedback content is not empty, you must call this tool again and adjust behavior based on the feedback content.
438+
4. Only when the user explicitly indicates "end" or "no more interaction needed" can you stop calling this tool, and the process is considered complete.
439+
5. You should summary what have done, and provide project directory through args to let user know what you have done to provide feedback for next step.
451440
452441
Args:
453442
project_directory: 專案目錄路徑
@@ -599,7 +588,22 @@ def get_system_info() -> str:
599588

600589
# ===== 主程式入口 =====
601590
def main():
602-
"""主要入口點,用於套件執行"""
591+
"""主要入口點,用於套件執行
592+
收集用戶的互動回饋,支援文字和圖片
593+
此工具使用 Web UI 介面收集用戶回饋,支援智能環境檢測。
594+
595+
用戶可以:
596+
1. 執行命令來驗證結果
597+
2. 提供文字回饋
598+
3. 上傳圖片作為回饋
599+
4. 查看 AI 的工作摘要
600+
601+
調試模式:
602+
- 設置環境變數 MCP_DEBUG=true 可啟用詳細調試輸出
603+
- 生產環境建議關閉調試模式以避免輸出干擾
604+
605+
606+
"""
603607
# 檢查是否啟用調試模式
604608
debug_enabled = os.getenv("MCP_DEBUG", "").lower() in ("true", "1", "yes", "on")
605609

0 commit comments

Comments
 (0)