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-statusin scripts so 4xx/5xx produce non-zero exits. - Use explicit method forms (
get,post) for readability. - Use
key:=valuefor raw JSON numbers/booleans, not quoted strings.
Common Pitfalls
key=valuesends strings;key:=valuesends 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.
-bprints body only;-hprints headers only.--print=hHbBcontrols 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."