https://en.wikipedia.org/wiki/Stochastic_parrot
This is my llm cli tool. There are many like it, but this one is mine.
NAME:
polly - Chat with LLMs using various providers
USAGE:
polly [global options]
GLOBAL OPTIONS:
--model string, -m string Model to use (provider/model format) (default: "anthropic/claude-sonnet-4-20250514")
--temp float Temperature for sampling (default: 1)
--maxtokens int Maximum tokens to generate (default: 4096)
--timeout duration Request timeout (default: 2m0s)
--think Enable thinking/reasoning (low effort) (default: false)
--think-medium Enable thinking/reasoning (medium effort) (default: false)
--think-hard Enable thinking/reasoning (high effort) (default: false)
--baseurl string Base URL for API (for OpenAI-compatible endpoints or Ollama)
--tool string, -t string [ --tool string, -t string ] Tool provider: shell script or MCP server (can be specified multiple times)
--tooltimeout duration Tool execution timeout (default: 2m0s)
--prompt string, -p string Initial prompt (reads from stdin if not provided)
--system string, -s string System prompt (default: "Your output will be displayed in a unix terminal. Be terse, 512 characters max. Do not use markdown.")
--file string, -f string [ --file string, -f string ] File, image, or URL to include (can be specified multiple times)
--schema string Path to JSON schema file for structured output
--context string, -c string Context name for conversation continuity (uses POLLYTOOL_CONTEXT env var if not set)
--last, -L Use the last active context (default: false)
--reset Reset context (clear conversation history, keep settings) (default: false)
--list List all available context IDs (default: false)
--delete string Delete the specified context
--add Add stdin content to context without making an API call (default: false)
--purge Delete all sessions and index (requires confirmation) (default: false)
--create string Create a new context with specified name and configuration
--show string Show configuration for the specified context
--quiet Suppress confirmation messages (default: false)
--debug, -d Enable debug logging (default: false)
--help, -h show help
- Many Models: OpenAI, Anthropic, Gemini, Ollama.
- Multimodal: Text, pics, random files.
- Structured Output: JSON on purpose, not by accident.
- Tool Calling: Bolt on shell scripts & MCP servers.
- Contexts: Memory, but opt‑in.
- Streaming: Words appear while it thinks.
- API: Do the things yourself docs
go build -o polly ./cmd/polly/export POLLYTOOL_ANTHROPICKEY=...
export POLYTOOL_OPENAIKEY=....
# Basic
echo "Hello?" | polly
# Pick a model
echo "Quantum computing in one breath" | polly -m openai/gpt-4.1
# Image
polly -f image.jpg -p "What’s this?"
# Remote image
polly -f https://example.com/image.png -p "Describe it"
# Mixed bag
polly -f notes.txt -f https://example.com/chart.png -p "Tie these together"
# Tools example - auto-detects shell tools vs MCP servers
./polly -p "uppercase this: hello" --tool ./uppercase.sh
./polly -p "create news.txt with today's news" --tool perp.json --tool filesystem.jsonThe default model is anthropic/claude-sonnet-4-20250514. Override with -m flag:
# Create a new named context with configuration
polly --create project --model openai/gpt-4.1 --maxtokens 4096
# Show context configuration
polly --show project
# Use the context (prompt required via -p or piped input)
echo "I'm working on a Python web app" | polly -c project
# Continue the conversation
polly -c project -p "What database should I use?"
# Reset a context (clear conversation, keep settings)
polly --reset -c project
# List all contexts
polly --list
# Delete a context
polly --delete project
# Delete all contexts (requires confirmation)
polly --purgeContexts remember your settings (model, temperature, system prompt, active tools) between conversations:
# First use - settings are saved
polly -c helper -m gemini/gemini-2.5-pro -s "You are a SQL expert" -p "Hello"
# Later uses - settings are automatically restored
polly -c helper -p "Write a complex JOIN query"
# Use the last active context
polly --last -p "Explain the query"
Polly manages context settings with a clear priority system:
-
Settings Persistence
When you use a context, your current settings (model, temperature, system prompt, tools) are automatically saved to that context's metadata. -
Settings Inheritance
When you resume a context, Polly restores the previously saved settings—unless you override them with command-line flags. -
Settings Priority
Command-line flags always take precedence over stored context settings.
Example:
If your context usesopenai/gpt-5but you run-m openai/gpt-4.1, Polly switches to GPT-4.1 and saves this change for future use. -
System Prompt Changes
If you change the system prompt for a context with existing conversation history, Polly automatically resets the conversation to keep things consistent.
Polly now provides unified tool management for both shell scripts and MCP servers:
Tools are auto-detected based on file type:
- Shell scripts (
.shfiles): Loaded as individual tools - MCP servers (
.jsonfiles): Can provide multiple tools from one server
# Load a shell tool
polly -t ./uppercase.sh -p "make this LOUD: hello"
# Load an MCP server (JSON config)
polly -t filesystem.json -p "list files in /tmp"
# Mix both types
polly -t ./mytool.sh -t perplexity.json -p "search and process"To avoid conflicts, tools are automatically namespaced:
- Shell tools:
scriptname__toolname(e.g.,uppercase__to_uppercase) - MCP tools:
servername__toolname(e.g.,filesystem__read_file)
When tools are loaded in a context, they're automatically saved and restored:
# Tools are saved with the context
polly -c project -t ./build.sh -p "build the project"
# Later, tools are automatically restored
polly -c project -p "run tests" # build.sh is still availableUse JSON schemas to get structured, validated responses:
# Create a schema file
cat > person.schema.json << 'EOF'
{
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"},
"email": {"type": "string"}
},
"required": ["name", "age"]
}
EOF
# Extract structured data
echo "John Doe is 30 years old, email: john@example.com" | \
polly --schema person.schema.jsonOutput:
{
"name": "John Doe",
"age": 30,
"email": "john@example.com"
}# Analyze image with structured output
polly -f receipt.jpg --schema receipt.schema.jsonCreate executable scripts that follow the tool protocol:
#!/bin/bash
# uppercase_tool.sh
if [ "$1" = "--schema" ]; then
cat <<SCHEMA
{
"title": "uppercase",
"description": "Convert text to uppercase",
"type": "object",
"properties": {
"text": {"type": "string", "description": "Text to convert"}
},
"required": ["text"]
}
SCHEMA
elif [ "$1" = "--execute" ]; then
text=$(echo "$2" | jq -r .text)
echo "${text^^}"
fiUse the tool:
polly -t ./uppercase_tool.sh -p "Convert 'hello world' to uppercase"MCP servers are configured through JSON files using the Claude Desktop format. A single config file can define multiple servers:
# Create an MCP server config
cat > mcp.json << 'EOF'
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/workspace"]
},
"perplexity": {
"command": "uvx",
"args": ["perplexity-mcp"],
"env": {
"PERPLEXITY_API_KEY": "pplx-..."
}
}
}
}
EOF
# Load all servers from the config
polly -t mcp.json -p "List files and search for tutorials"
# Or load a specific server
polly -t mcp.json#filesystem -p "List files in the workspace"MCP servers can also connect via SSE or Streamable HTTP transports:
{
"mcpServers": {
"remote-api": {
"transport": "sse",
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer ..."
},
"timeout": "60s"
}
}
}cat > servers.json << 'EOF'
{
"mcpServers": {
"perplexity": {
"command": "uvx",
"args": ["perplexity-mcp"],
"env": {
"PERPLEXITY_API_KEY": "pplx-..."
}
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/files"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_..."
}
}
}
}
EOF# Use a custom Ollama endpoint
polly --baseurl http://192.168.1.100:11434 -m ollama/llama3.2 -p "Hello"
# Use OpenAI-compatible endpoint
polly --baseurl https://api.openrouter.ai/api/v1 -m openai/whatevermodel -p "Hello"- Supports GPT-4, 4.1, 5 and their distills
- OpenAI compatible endpoints with --baseurl
- Structured output uses
additionalProperties: falsein schema - Reliable schema support
- Supports Claude family (Opus, Sonnet, Haiku)
- Uses tool-use pattern for structured output
- Excellent for long-form content and analysis
- Mostly reliable schema support
- Supports Gemini Pro and Flash models
- Good balance of speed and capability
- Reliable schema output support via ResponseSchema
- Requires Ollama installation
- Supports any model available in Ollama
- Use --baseurl for remote instances
- Schema support hit and miss, depends on model
- Soulshack - An IRC chatbot that uses Polly for LLM features.
MIT
