Send a quick headless query to Gemini CLI and display the response with stats
Sends queries to Gemini CLI and displays the response with usage statistics.
/plugin marketplace add melodic-software/claude-code-plugins/plugin install claude-ecosystem@melodic-software<prompt>Execute a quick headless query to Gemini CLI and display the response.
/google-ecosystem:gemini-query <prompt>
/google-ecosystem:gemini-query What is the capital of France?/google-ecosystem:gemini-query Explain async/await in JavaScript/google-ecosystem:gemini-query Review this error: TypeError: Cannot read property 'x' of undefinedRun the query using Gemini CLI headless mode:
result=$(gemini "$ARGUMENTS" --output-format json 2>&1)
Parse and present the response:
.response.stats.error# Extract response
response=$(echo "$result" | jq -r '.response // "No response"')
# Extract stats
tokens=$(echo "$result" | jq '.stats.models | to_entries | map(.value.tokens.total) | add // 0')
cached=$(echo "$result" | jq '.stats.models | to_entries | map(.value.tokens.cached) | add // 0')
models=$(echo "$result" | jq -r '.stats.models | keys | join(", ") | if . == "" then "unknown" else . end')
latency=$(echo "$result" | jq '.stats.models | to_entries | map(.value.api.totalLatencyMs) | add // 0')
# Check for errors
error=$(echo "$result" | jq -r '.error.message // empty')
Present the results in a clean format:
## Gemini Response
{response}
---
**Stats**: {tokens} tokens ({cached} cached) | Model: {models} | Latency: {latency}ms
If there's an error:
## Error
**Type**: {error_type}
**Message**: {error_message}
--output-format json for structured parsing