Merge CLI
The Merge CLI is a lightweight command-line tool for interacting with Agent Handler. It provides semantic tool search, schema inspection, and tool execution — purpose-built for AI coding agents like Claude Code and Cursor that need progressive tool discovery without overwhelming the context window.
Prerequisites
- Tool Pack ID: The ID of the tool pack to use. Found in the Agent Handler dashboard or via the GET /tool-packs endpoint.
- Registered User ID: The ID of the user who will interact with your agent. Found in the dashboard or created via API.
- Production Access Key: Your Merge Agent Handler API key for authentication.
Test access keys must be paired with test registered users, and production keys with production users.
Getting Started
Configure credentials
Run the interactive setup:
This saves your credentials to ~/.merge/config.json.
Alternatively, set environment variables:
Search for tools
Find tools using natural language:
Output:
Use --no-schema to reduce output size, or --connector slack to filter by connector.
Commands
Key Options
--connector <slug>: Filter search or list results by connector (e.g.,slack,jira,github)--no-schema: Omit input schemas from search results to reduce context size--full: Include full schemas when listing tools--max-results <n>: Limit number of search results (default: 2, max: 50)
Configuration
Credentials are resolved in this priority order (highest to lowest):
- CLI flags:
--api-key,--tool-pack-id,--registered-user-id,--base-url - Environment variables:
MERGE_AH_API_KEY,MERGE_AH_TOOL_PACK_ID,MERGE_AH_REGISTERED_USER_ID,MERGE_AH_BASE_URL - Config file:
~/.merge/config.json
Example config file:
Using with AI Agents
The CLI outputs structured JSON to stdout with hint fields that guide agents on next steps. Warnings go to stderr so they never contaminate the JSON output.
The fastest way to configure your AI agent is the merge setup command:
Claude Code
This automatically:
- Appends merge CLI workflow instructions to your
CLAUDE.md(creates it if it doesn’t exist) - Adds
Bash(merge *)permission to.claude/settings.json
Safe to run multiple times — it won’t duplicate content.
Cursor
This appends merge CLI instructions to your .cursorrules (or creates it if it doesn’t exist).
Any AI Agent (AGENTS.md)
This appends merge CLI instructions to your AGENTS.md (or creates it if it doesn’t exist) — the cross-tool standard supported by Claude Code, Cursor, Codex, Windsurf, and more.
Agent Workflow
Once configured, your agent follows this workflow:
merge search-tools "<intent>"— find the right toolmerge get-tool-schema <tool>— get its input parametersmerge execute-tool <tool> '<json_params>'— execute with JSON params
Output Format
All commands return JSON with a consistent structure.
Success:
Error:
Troubleshooting
Keep your API key secure. Never commit it to version control. Use environment variables or merge configure to store credentials safely.