MCP, Code, or Commands? A Decision Framework for AI Tool Integration
Source: Dev.to
The Decision Framework
Quick Decision Guide
| Situation | Recommended Approach |
|---|---|
| Repeating task (>20 executions), large datasets, need predictable costs | MCP Optimized |
| One‑off exploration, evolving requirements, prototyping | Code‑Driven (Skills) |
| User must control when it runs, deterministic behavior needed | Slash Commands |
| Production system with security requirements | MCP Optimized (never Skills) |
Decision Flowchart
Q1: One‑off task ( 100 rows AND need 20 AND requirements stable?
YES → MCP Optimized
NO → Code‑Driven (prototype, then migrate)
NEVER:
- MCP Vanilla for production (always suboptimal)
- Skills for multi‑user or sensitive systems
The Three Approaches Explained
MCP (Model Context Protocol)
A structured protocol for AI‑tool communication. The model calls tools with JSON parameters, the server executes and returns structured results.
// MCP tool call – structured, typed, validated
await call_tool('analyze_csv_file', {
file_path: '/data/employees.csv',
analysis_type: 'salary_by_department'
});
Characteristics: Structured I/O, access‑controlled, model‑decided invocation, reusable across applications.
Critical distinction: A 5× token difference exists between vanilla MCP (passing data directly) and optimized MCP (passing file references). Same protocol, vastly different economics.
Code‑Driven (Skills & Code Generation)
The model writes and executes code to accomplish tasks. Claude Code’s “skills” feature lets the model invoke capabilities based on semantic matching.
# Claude writes this, executes it, iterates
import pandas as pd
df = pd.read_csv('/data/employees.csv')
result = df.groupby('department')['salary'].mean()
print(result)
Characteristics: Maximum flexibility, unstructured I/O, higher variance between runs, requires sandboxing.
Slash Commands
Pure string substitution. You type /review @file.js, the command template expands, and the result injects into your message.
Review the following file for security vulnerabilities,
performance issues, and code quality:
{file_content}
Focus on: authentication, input validation, error handling.
Characteristics: User‑explicit, deterministic, single‑turn, zero tool‑call overhead.
Measured Data: What the Numbers Show
Methodology
- Workload: Load a 500‑row CSV, perform grouping, summary stats, and generate two plots.
- Model: Claude Sonnet, default settings.
- Runs: 3–4 runs per approach with logged request/response payloads.
- Cost calculation: Based on current Claude Sonnet pricing.
Token Consumption

| Approach | Avg tokens/run | vs Baseline | Why |
|---|---|---|---|
| MCP Optimized | 60,420 | -55% | File‑path parameters; zero data duplication |
| MCP Proxy (warm) | 81,415 | -39% | Shared context + warm cache |
| Code‑Skill (baseline) | 133,006 | — | Model‑written Python; nothing cached |
| UTCP Code‑Mode | 204,011 | +53% | Extra prompt framing |
| MCP Vanilla | 309,053 | +133% | JSON‑serialized data in every call |
Cost at Scale
| Approach | Per Execution | Monthly | Annual |
|---|---|---|---|
| MCP Optimized | $0.21 | $210 | $2,520 |
| Code‑Skill | $0.44 | $440 | $5,280 |
| MCP Vanilla | $0.99 | $990 | $11,880 |
Result: A $9,360 annual difference between optimized and vanilla MCP for a single workflow.
Scalability

| Approach | Scaling Factor | 10K Row Projection |
|---|---|---|
| MCP Optimized | 1.5× | ~65K tokens |
| Code‑Skill | 1.1–1.6× | ~150–220K tokens |
| MCP Vanilla | 2.0–2.9× | ~500–800K tokens |
MCP Optimized exhibits sub‑linear scaling because file paths cost the same tokens regardless of file size, whereas MCP Vanilla shows super‑linear scaling due to JSON serialization of larger datasets.
Variance
| Approach | Coefficient of Variation | Consistency |
|---|---|---|
| MCP Optimized | 0.6% | Excellent |
| MCP Proxy (warm) | 0.5% | Excellent |
| Code‑Skill | 18.7% | Poor |
| MCP Vanilla | 21.2% | Poor |
MCP Optimized’s runs were tightly clustered (60,307 – 60,808 tokens). Code‑Skill varied from 108K to 158K tokens, making capacity planning difficult.
Latency
Skills and sub‑agents use tool‑calling, which adds an extra LLM invocation:
User message → Model decides → Tool call → Tool result → Final response
Slash commands avoid this extra step; they are simple prompt injections with a direct response.
Key Lessons
1. Architecture Trumps Protocol
The 5× token difference between MCP Optimized and MCP Vanilla uses the same protocol. The difference stems entirely from architecture: file paths vs. data arrays. Prioritize data‑flow design over protocol debates.
2. The File‑Path Pattern
Eliminate data duplication by passing references instead of raw data.
// Anti‑pattern: 10,000 tokens just for data
await call_tool('analyze_data', {
data: [/* 500 rows serialized */]
});
// Pattern: ~50 tokens for the same operation
await call_tool('analyze_csv_file', {
file_path: '/data/employees.csv'
});
The MCP server handles file I/O internally, so data never enters the model’s context window.
3. Prototype with Skills, Ship with MCP
Skills (code generation) are excellent for rapid prototyping and discovering needed tooling. However, they execute arbitrary code and are unsuitable for production systems where security and predictability matter.
4. Slash Commands Are Underrated
When deterministic, user‑controlled workflows are required, slash commands win. They incur no tool‑call overhead, avoid model surprises, and have no latency penalty. Use them for simple, repeatable actions where the user explicitly invokes the operation.