Choosing and connecting tools
Scope a toolset, connect MCP servers, and trace an unfamiliar code path.
Equip a developer assistant
A repository helper answers questions about release notes, code, and issue history. It can inspect sources but only a separate publishing step may write a release. Tool access should reflect those responsibilities.
2.3 · Control which operations are available
Give each worker the smallest practical tool set. An editor that repeatedly verifies citations may get a read-only lookup limited to approved references. Delegate a wider investigation to the coordinator. Replace an unrestricted fetch with a resolver that validates the reference before reading it. Review traces to see whether the shortcut saves handoffs without adding unrelated capabilities.
In the Messages API, tool_choice with type auto lets Claude answer directly or request a tool. Use any when a tool call is required but several are suitable. To require the metadata operation first, choose {"type":"tool","name":"read_metadata"} for that turn, process its result, then offer the appropriate next tools. The host still authorizes every call.
Force one extraction without granting every tool
An intake worker receives a new document. First the host must obtain its type and revision. Afterwards the worker may use one of two specialized extractors. A separate synthesis worker occasionally needs to verify a page in a document already collected. Choose each tool surface.
Trace two model turns
For the first Messages API turn, expose the metadata tool and force it by name. Validate the returned type and revision before selecting the tools for the next turn. If the worker must call one of several approved extractors, tool_choice set to any can require a call. With auto, a text reply is possible. The host verifies that the expected action actually completed.
The synthesis worker needs a narrow page verifier scoped to the supplied document IDs. Route broad new research through the coordinator. Granting unrestricted retrieval to every specialist makes selection harder and lets a worker act outside the evidence boundary of its job.
Video background · freeCodeCamp at 9:13:48 · Automatic, required and named tool choices
2.4 · Connect shared and personal MCP servers
Check shared server definitions into project-level .mcp.json. Reference credentials through environment variables such as ${ISSUE_TOKEN} supplied at runtime. A developer’s experimental server belongs in user scope, managed through Claude Code and stored in ~/.claude.json. Several connected servers can expose tools together. Make their names and descriptions distinguish live tickets from repository text.
Choose a maintained integration for a standard issue tracker after verifying its capabilities and permissions. A custom server earns its cost when the team needs a specific operation the existing integration cannot express. Expose a read-only catalog, document index, or schema via MCP resources so discovery can start from known references.
Set up a connector for a new teammate
A project shares an issue-tracker integration. A new teammate sees the server configured but gets a permission error on an issue. A veteran has a personal prototype server that also lists issues. Where should the definitions live, and how can the teammate diagnose the discrepancy?
Trace configuration, credential and discovery
Commit the shared server definition in project .mcp.json with environment substitution for credentials. Each user supplies a credential with their own grants. Keep a personal experiment in user scope and use distinguishable server and tool names. Check connection and discovery, then exercise an authorized issue and the restricted issue separately. Seeing a tool name does not grant access to every issue.
Expose an issue catalog or schema as an MCP resource when it can answer “what is available?” directly. Describe when the remote tracker supplies information absent from a local repository search. An existing maintained connector may cover standard issue operations. A team-specific approval workflow needs its own contract and authorization review.
Video background · freeCodeCamp at 11:31:32 · MCP resources and tools
2.5 · Trace code using built-in tools
Use Glob to find matching paths, Grep to locate an identifier or error message, and Read to inspect selected definitions. Follow re-exports and search again for aliases. Use Edit for a bounded replacement with a unique anchor. If an anchor is ambiguous, read the surrounding code, choose a longer unique match, or read and rewrite the full file with Write after checking concurrent edits. Use Bash for a bounded command such as the project’s test runner.
Follow an alias to the line that actually changes
A package defines computeCutoff, re-exports it as deadline, and imports the alias in the reporter. Two identical default values occur in the target file. Which searches and edit establish that the reporter, and only the reporter, changed?
Reconstruct a minimal tool sequence
Use Grep to find the definition and exports. Read the export to identify the alias, then search for consumers of that alias as well as the original name. Use Glob for the paths of candidate tests and Read for their contents. This avoids loading unrelated files into the investigation.
Use Edit with enough neighboring text to identify the reporter’s branch uniquely. If a safe unique anchor is unavailable, read the latest complete file and apply a checked replacement with Write, preserving concurrent changes. Inspect the diff for an untouched second default. Use Bash for the existing targeted test and record the actual result.
Video background · freeCodeCamp at 9:09:07 · Built-in search and file tools
Trace exercise
A public wrapper exports ship under the name dispatch. Searching only for ship( misses downstream calls. Read the export and search import sites and calls for both names. Confirm the call chain before proposing an edit.
Further reading · Subagents in the Agent SDK · MCP connections and scope
Choosing and connecting tools quiz
Answer 9 questions. Check each answer for an explanation.