| name | tool-xh |
| description | Use xh as a user-friendly HTTP client for API testing and response inspection. Trigger when quick REST calls with clean defaults are needed. |
tool-xh
When To Use
- Probe HTTP endpoints quickly with clean CLI syntax.
- Send JSON requests and inspect response headers/status.
- Validate API behavior with straightforward failure handling.
Trusted Commands
xh get httpbin.org/json
xh post httpbin.org/post name=Alice age:=30
xh get api.example.com Authorization:"Bearer $TOKEN"
xh --json get api.example.com
xh --follow get example.com
xh --print=hHbB get httpbin.org/get
xh --check-status get api.example.com
xh -b get api.example.com
xh -h get api.example.com
xh --download get example.com/file.zip
Safe Defaults
- Use
--check-status in scripts so 4xx/5xx produce non-zero exits.
- Use explicit method forms (
get, post) for readability.
- Use
key:=value for raw JSON numbers/booleans, not quoted strings.
Common Pitfalls
key=value sends strings; key:=value sends typed JSON.
- Headers and bodies can leak secrets in shell history if not handled carefully.
- xh option behavior is not one-to-one with curl flags.
Output Interpretation
- Pretty response body is written to stdout by default.
-b prints body only; -h prints headers only.
--print=hHbB controls request/response header/body visibility.
Why It Matters For Agents
- Reduces curl quoting complexity for API tests.
- Combines readable defaults with strict exit handling when needed.
Repo Conventions
- Prefer xh for interactive API probing.
- Use curl when low-level transfer or compatibility control is required.
Trigger Examples
- Should trigger: "Quickly test this webhook endpoint with JSON body."
- Should trigger: "Show response headers for this API URL."
- Should not trigger: "Rename a function symbol across source files."