Files
CrazyClaude/tools/web_search_tavily.sh
Eric Coissac 2f1d437723 Squashed '.claude/llm-functions/' content from commit 616d8d8
git-subtree-dir: .claude/llm-functions
git-subtree-split: 616d8d84c5565fdb66d8782ae5ba56d994bfa82a
2026-03-27 09:14:17 +01:00

25 lines
674 B
Bash
Executable File

#!/usr/bin/env bash
set -e
# @describe Perform a web search using Tavily API to get up-to-date information or additional context.
# Use this when you need current information or feel a search could provide a better answer.
# @option --query! The query to search for.
# @env TAVILY_API_KEY! The api key
# @env LLM_OUTPUT=/dev/stdout The output path The output path
main() {
curl -fsSL -X POST https://api.tavily.com/search \
-H "content-type: application/json" \
-d '
{
"api_key": "'"$TAVILY_API_KEY"'",
"query": "'"$argc_query"'",
"include_answer": true
}' | \
jq -r '.answer' >> "$LLM_OUTPUT"
}
eval "$(argc --argc-eval "$0" "$@")"