Skip to content

Commit ffbd1f4

Browse files
author
flowcore-platform
committed
feat(action, scripts): improve MCP cache refresh output handling
- Enhanced the MCP cache refresh logic in both action and testing scripts to provide clearer output messages based on the success or failure of the refresh operation. - Implemented specific handling for timeout scenarios and cases where the cache directory does not exist, improving user awareness during the process. - Streamlined error reporting to include the first error message encountered during cache refresh failures, aiding in troubleshooting and debugging.
1 parent f7ebfa3 commit ffbd1f4

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

action.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,20 @@ runs:
348348
# Refresh MCP cache before validation
349349
echo "🔄 Refreshing MCP cache..."
350350
set +e
351-
if timeout 30 forge mcp cache refresh 2>&1; then
351+
CACHE_OUTPUT=$(timeout 30 forge mcp cache refresh 2>&1)
352+
CACHE_EXIT=$?
353+
set -e
354+
355+
if [ $CACHE_EXIT -eq 0 ]; then
352356
echo "✅ MCP cache refreshed successfully"
357+
elif [ $CACHE_EXIT -eq 124 ]; then
358+
echo "⚠️ MCP cache refresh timed out after 30 seconds (continuing anyway)"
359+
elif echo "$CACHE_OUTPUT" | grep -q "No such file or directory"; then
360+
echo "⚠️ No cache directory exists yet (first run) - skipping cache refresh"
353361
else
354-
EXIT_CODE=$?
355-
if [ $EXIT_CODE -eq 124 ]; then
356-
echo "⚠️ MCP cache refresh timed out after 30 seconds (continuing anyway)"
357-
else
358-
echo "⚠️ MCP cache refresh failed (this is normal on first run - continuing anyway)"
359-
fi
362+
echo "⚠️ MCP cache refresh failed - continuing anyway"
363+
echo " Error: $(echo "$CACHE_OUTPUT" | grep -i "error" | head -1)"
360364
fi
361-
set -e
362365
echo ""
363366
364367
# Run ForgeCode directly with MCP stdio transport

scripts/test-mcp-connection.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,20 @@ forge mcp list 2>&1 || echo "⚠️ forge mcp list command not available or fai
8686
echo ""
8787
echo "🔄 Refreshing MCP cache..."
8888
set +e
89-
if timeout 30 forge mcp cache refresh 2>&1; then
89+
CACHE_OUTPUT=$(timeout 30 forge mcp cache refresh 2>&1)
90+
CACHE_EXIT=$?
91+
set -e
92+
93+
if [ $CACHE_EXIT -eq 0 ]; then
9094
echo "✅ MCP cache refreshed successfully"
95+
elif [ $CACHE_EXIT -eq 124 ]; then
96+
echo "⚠️ MCP cache refresh timed out after 30 seconds (continuing anyway)"
97+
elif echo "$CACHE_OUTPUT" | grep -q "No such file or directory"; then
98+
echo "⚠️ No cache directory exists yet (first run) - skipping cache refresh"
9199
else
92-
EXIT_CODE=$?
93-
if [ $EXIT_CODE -eq 124 ]; then
94-
echo "⚠️ MCP cache refresh timed out after 30 seconds (continuing anyway)"
95-
else
96-
echo "⚠️ MCP cache refresh failed (this is normal on first run - continuing anyway)"
97-
fi
100+
echo "⚠️ MCP cache refresh failed - continuing anyway"
101+
echo " Error: $(echo "$CACHE_OUTPUT" | grep -i "error" | head -1)"
98102
fi
99-
set -e
100103

101104
echo ""
102105
echo "Note: Using stdio transport via npx @usabledev/mcp-server"

0 commit comments

Comments
 (0)