@@ -186,14 +186,15 @@ Input Schema:
186186# With inline JSON
187187$ mcp-cli github/search_repositories ' {"query": "mcp server", "per_page": 5}'
188188
189- # From stdin (pipe)
190- $ echo ' {"query": "mcp"}' | mcp-cli github/search_repositories
191-
192189# JSON output for scripting
193190$ mcp-cli github/search_repositories ' {"query": "mcp"}' --json | jq ' .content[0].text'
191+
192+ # Chain Calls and outputs
193+ $ echo ' {"path": "./README.md"}' | mcp-cli filesystem/read_file
194+
194195` ` `
195196
196- # ### Complex JSON with Quotes
197+ # ### Complex Commands
197198
198199For JSON arguments containing single quotes, special characters, or long text, use ** stdin** to avoid shell escaping issues:
199200
@@ -212,6 +213,9 @@ cat args.json | mcp-cli server/tool
212213
213214# Using jq to build complex JSON
214215jq -n ' {query: "mcp", filters: ["active", "starred"]}' | mcp-cli github/search
216+
217+ # Find all TypeScript files and read the first one
218+ mcp-cli filesystem/search_files ' {"path": "src/", "pattern": "*.ts"}' --json | jq -r ' .content[0].text' | head -1 | xargs -I {} sh -c ' mcp-cli filesystem/read_file "{\"path\": \"{}\"}"'
215219` ` `
216220
217221** Why stdin?** Shell interpretation of ` {}` , quotes, and special characters requires careful escaping. Stdin bypasses shell parsing entirely, making it reliable for any JSON content.
@@ -322,6 +326,9 @@ $ echo '{"query": "mcp"}' | mcp-cli github/search_repositories
322326mcp-cli server/tool <<EOF
323327{"content": "Text with ' single quotes' and \"double quotes\""}
324328EOF
329+
330+ # Complex Command chaining with xargs and jq
331+ mcp-cli filesystem/search_files ' {" path" : " src/" , " pattern" : " *.ts" }' --json | jq -r ' .content[0].text' | head -1 | xargs -I {} sh -c ' mcp-cli filesystem/read_file " {\" path\" : \" {}\" }" '
325332```
326333
327334### Rules
0 commit comments