/major-ai-skills:tool-choice-forcingfrom major-ai-skills
Select a required or named tool through supported API controls and validate the resulting arguments before execution.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When an orchestrator invokes a specialized sub-task (e.g., "Look up the definition of SessionToken using grep_search"), setting default tool_choice: "auto" frequently causes the model to output conversational text ("I will now proceed to search the codebase for you using the grep tool...") instead of actually executing the tool call.
Conversational dodging causes:
The Deterministic Tool Choice Forcing Protocol sets tool_choice: {"type": "function", "function": {"name": "..."}} or tool_choice: "required", forcing the model's first output token to be the function invocation payload.
auto) vs. Forced Tool Execution (tool_choice)┌─────────────────────────────────────────────────────────────┐
│ Tool Invocation Dynamics │
│ │
│ Default Unconstrained (`tool_choice: "auto"` - 2 Turns): │
│ • Model: "Sure! Let me run `grep_search` to find that..." │
│ • System: "Please proceed with the tool call." │
│ • Model: Calls `grep_search("SessionToken")` │
│ ↳ 2 Turns, 350 tokens wasted on conversational hedging │
│ │
│ Forced Tool Choice (`tool_choice: {name: "grep_search"}`): │
│ • Model Turn 1 Byte 0: `tool_calls: [{"name":"grep_search",│
│ "arguments": {"Query": "SessionToken"}}]` │
│ ↳ 1 Turn, 0 conversational text, instant tool execution! │
└─────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────────────┐
│ 1. `tool_choice: "auto"` │
│ • Model decides whether to chat or call any tool (Use for open chat) │
│ │
│ 2. `tool_choice: "required"` │
│ • Model is FORCED to call at least one tool, but chooses which one │
│ │
│ 3. `tool_choice: {"type": "function", "function": {"name": "target_fn"}}` │
│ • Model is FORCED to invoke the exact specified tool (Zero chatter) │
└───────────────────────────────────────────────────────────────────────────┘
from openai import OpenAI
client = OpenAI()
def force_grep_execution(query: str, search_path: str) -> dict:
"""Guarantees immediate grep_search execution with zero conversational preamble."""
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a code search engine."},
{"role": "user", "content": f"Locate symbol: {query} in {search_path}"}
],
tools=[{
"type": "function",
"function": {
"name": "grep_search",
"parameters": {
"type": "object",
"properties": {
"Query": {"type": "string"},
"SearchPath": {"type": "string"}
},
"required": ["Query", "SearchPath"]
}
}
}],
# FORCES immediate execution of grep_search
tool_choice={"type": "function", "function": {"name": "grep_search"}},
temperature=0.0
)
# Tool call arguments available on Turn 1
tool_call = response.choices[0].message.tool_calls[0]
return json.loads(tool_call.function.arguments)
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[{"role": "user", "content": "Extract error log from text..."}],
tools=tool_definitions,
# Force invocation of specific tool
tool_choice={"type": "tool", "name": "extract_error_log"}
)
Running 200 automated multi-step agent actions:
| Configuration | First-Turn Tool Invocation Rate | Conversational Chatter Tokens | Pipeline Failures |
|---|---|---|---|
Default tool_choice: "auto" | 76.5% (23.5% announced actions) | 6,400 tokens | 18 parsing errors |
| Forced Tool Choice Protocol | 100% (Instant execution) | 0 tokens (100% Elimination) | 0 parsing errors |
MANDATORY: For deterministic subagent steps, log extractors, and automated search routines, orchestrators must explicitly set
tool_choice: {"type": "function", "function": {"name": "..."}}. Never rely onautowhen a specific tool call is mandatory.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization.Other plugins' skills for the same job
/act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.