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:
Set up your AI agent
Configure your AI coding agent to use the Merge CLI:
This adds Merge CLI workflow instructions to your agent’s config file. See Using with AI Agents for details on each target.
Commands
Key Options
--connector <slug>: Filter search or list results by connector (e.g.,slack,jira,github)--schema [compact|full|none]: Schema detail level for search results (default: compact)--full: Include full schemas when listing tools--compact: Show tool names with param names only 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 tool (returns compact schemas)merge execute-tool <tool> '<json_params>'— execute with JSON params
Search returns schemas by default, so agents can go straight from search to execute without a separate schema fetch.
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.