aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/run-mcp-tool.sh
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-12-13 08:20:51 +0800
committerGitHub <noreply@github.com>2024-12-13 08:20:51 +0800
commit8ace93beb813a431b4f26e277f8c0bcebdfa8511 (patch)
treef654dafb8e28347bf7f2f503e72cfdaf5ed9e5a5 /scripts/run-mcp-tool.sh
parent8e8b2f736b8e635396e713e219c8fe8575a6f491 (diff)
downloadllm-functions-docker-8ace93beb813a431b4f26e277f8c0bcebdfa8511.tar.gz
feat(mcp): add LLM_MCP_NEED_CONFIRM and LLM_MCP_SKIP_CONFIRM (#149)
Diffstat (limited to 'scripts/run-mcp-tool.sh')
-rwxr-xr-xscripts/run-mcp-tool.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/run-mcp-tool.sh b/scripts/run-mcp-tool.sh
index 08beafd..fb987e1 100755
--- a/scripts/run-mcp-tool.sh
+++ b/scripts/run-mcp-tool.sh
@@ -60,6 +60,25 @@ run() {
is_temp_llm_output=1
export LLM_OUTPUT="$(mktemp)"
fi
+
+ if [[ -n "$LLM_MCP_SKIP_CONFIRM" ]]; then
+ if grep -q -w -E "$LLM_MCP_SKIP_CONFIRM" <<<"$tool_name"; then
+ skip_confirm=1
+ fi
+ fi
+ if [[ -n "$LLM_MCP_NEED_CONFIRM" ]]; then
+ if grep -q -w -E "$LLM_MCP_NEED_CONFIRM" <<<"$tool_name"; then
+ skip_confirm=0
+ fi
+ fi
+ if [[ -t 1 ]] && [[ "$skip_confirm" -ne 1 ]]; then
+ read -r -p "Are you sure you want to continue? [Y/n] " ans
+ if [[ "$ans" == "N" || "$ans" == "n" ]]; then
+ echo "error: canceld!" 2>&1
+ exit 1
+ fi
+ fi
+
curl -sS "http://localhost:${MCP_BRIDGE_PORT:-8808}/tools/$tool_name" \
-X POST \
-H 'content-type: application/json' \