Connor Holly

← AI Skills

Agent Tools Design

Productivity

toolsarchitecturedecisions

What it does

Provides a decision framework for how AI agents should access external services. Three options exist, each with different tradeoffs. Picking the wrong one wastes tokens, adds complexity, or limits reusability.

The pattern

Option 1: MCP Server (Model Context Protocol)

The agent's context window permanently includes the tool's schema: available operations, parameter types, response formats. The agent can call tools natively without any external process.

  • Token cost: high (schema loaded every session, whether used or not)
  • Setup: moderate (implement the MCP server spec)
  • Composability: high (agents can chain tools fluently)
  • Best for: tools used frequently across many sessions

Option 2: CLI Script

A standalone script the agent invokes like any shell command. The agent knows nothing about the script's internals until it runs it. Output comes back as text.

  • Token cost: zero until invoked (no schema in context)
  • Setup: low (write a script, make it executable)
  • Composability: moderate (piping and chaining work, but the agent has no type information)
  • Best for: tools used occasionally, or tools with large schemas you do not want in context

Option 3: Direct API Call

The agent makes HTTP requests inline. No abstraction layer. The agent constructs the request, sends it, and parses the response.

  • Token cost: varies (agent needs the API documentation in context or in a reference file)
  • Setup: none (no wrapper to build)
  • Composability: low (each call is ad hoc)
  • Best for: one-off operations that will not be repeated

Decision matrix:

FactorMCP ServerCLI ScriptDirect API
Used every session?YesSometimesRarely
Schema sizeSmall-mediumAnyAny
Needs type safety?YesNoNo
Build effort justified?YesModerateNo

Progressive disclosure for large APIs. If an external service has 200 endpoints but you use 8 of them, do not expose all 200 via MCP. Write a CLI wrapper that exposes only the 8 operations you need. The agent sees 8 commands, not 200 endpoints. Expand the wrapper as new operations become necessary.

Key decisions

Token cost is the primary driver. An MCP server with a 3,000-token schema costs those tokens every session, even sessions that never use that tool. If the tool is used in fewer than half your sessions, CLI is the right choice.

CLI is the default. Start with a CLI script. Promote to MCP only when frequency of use justifies the permanent token cost.

Never expose more than you use. Every unnecessary operation in the schema is noise that can confuse the agent and waste context.

When to use it

When connecting an AI agent to a new external service. When your agent's context window is bloated with tool schemas it rarely uses. When building a toolkit for agents and want a consistent integration philosophy.