-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-mcp-cli.sh
More file actions
executable file
·74 lines (62 loc) · 1.99 KB
/
test-mcp-cli.sh
File metadata and controls
executable file
·74 lines (62 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# Test script to compare MCP token usage with/without ENABLE_EXPERIMENTAL_MCP_CLI
set -e
PROMPT="List all MCP tools you have access to, then exit with /exit"
JOURNAL_DIR="$HOME/.claude/projects"
TIMESTAMP=$(date +%s)
echo "=== MCP-CLI Token Comparison Test ==="
echo ""
# Find the most recent journal before tests
get_latest_journal() {
find "$JOURNAL_DIR" -name "*.jsonl" -type f -printf '%T@ %p\n' 2>/dev/null | sort -n | tail -1 | cut -d' ' -f2-
}
count_tool_definitions() {
local journal="$1"
if [[ -f "$journal" ]]; then
# Count tool definitions in system prompt (rough estimate)
grep -o '"name":\s*"mcp__' "$journal" 2>/dev/null | wc -l
else
echo "0"
fi
}
get_journal_size() {
local journal="$1"
if [[ -f "$journal" ]]; then
stat --printf="%s" "$journal" 2>/dev/null || echo "0"
else
echo "0"
fi
}
echo "Step 1: Run WITHOUT experimental flag"
echo "--------------------------------------"
echo "Run this command in a new terminal:"
echo ""
echo " claude --print-system-prompt 2>/dev/null | wc -c"
echo ""
echo "Note the character count, then press Enter to continue..."
read -r
echo ""
echo "Characters WITHOUT flag: "
read -r chars_without
echo ""
echo "Step 2: Run WITH experimental flag"
echo "-----------------------------------"
echo "Run this command in a new terminal:"
echo ""
echo " ENABLE_EXPERIMENTAL_MCP_CLI=true claude --print-system-prompt 2>/dev/null | wc -c"
echo ""
echo "Note the character count, then press Enter to continue..."
read -r
echo ""
echo "Characters WITH flag: "
read -r chars_with
echo ""
echo "=== Results ==="
echo "Without ENABLE_EXPERIMENTAL_MCP_CLI: $chars_without chars"
echo "With ENABLE_EXPERIMENTAL_MCP_CLI: $chars_with chars"
if [[ "$chars_without" -gt 0 && "$chars_with" -gt 0 ]]; then
reduction=$(( (chars_without - chars_with) * 100 / chars_without ))
echo ""
echo "Reduction: ${reduction}%"
echo "Saved: $((chars_without - chars_with)) characters in system prompt"
fi