MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getUsingYourToolsSection

Function getUsingYourToolsSection

src/constants/prompts.ts:269–314  ·  view source on GitHub ↗
(enabledTools: Set<string>)

Source from the content-addressed store, hash-verified

267}
268
269function getUsingYourToolsSection(enabledTools: Set<string>): string {
270 const taskToolName = [TASK_CREATE_TOOL_NAME, TODO_WRITE_TOOL_NAME].find(n =>
271 enabledTools.has(n),
272 )
273
274 // In REPL mode, Read/Write/Edit/Glob/Grep/Bash/Agent are hidden from direct
275 // use (REPL_ONLY_TOOLS). The "prefer dedicated tools over Bash" guidance is
276 // irrelevant — REPL's own prompt covers how to call them from scripts.
277 if (isReplModeEnabled()) {
278 const items = [
279 taskToolName
280 ? `Break down and manage your work with the ${taskToolName} tool. These tools are helpful for planning your work and helping the user track your progress. Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed.`
281 : null,
282 ].filter(item => item !== null)
283 if (items.length === 0) return ''
284 return [`# Using your tools`, ...prependBullets(items)].join(`\n`)
285 }
286
287 // Ant-native builds alias find/grep to embedded bfs/ugrep and remove the
288 // dedicated Glob/Grep tools, so skip guidance pointing at them.
289 const embedded = hasEmbeddedSearchTools()
290
291 const providedToolSubitems = [
292 `To read files use ${FILE_READ_TOOL_NAME} instead of cat, head, tail, or sed`,
293 `To edit files use ${FILE_EDIT_TOOL_NAME} instead of sed or awk`,
294 `To create files use ${FILE_WRITE_TOOL_NAME} instead of cat with heredoc or echo redirection`,
295 ...(embedded
296 ? []
297 : [
298 `To search for files use ${GLOB_TOOL_NAME} instead of find or ls`,
299 `To search the content of files, use ${GREP_TOOL_NAME} instead of grep or rg`,
300 ]),
301 `Reserve using the ${BASH_TOOL_NAME} exclusively for system commands and terminal operations that require shell execution. If you are unsure and there is a relevant dedicated tool, default to using the dedicated tool and only fallback on using the ${BASH_TOOL_NAME} tool for these if it is absolutely necessary.`,
302 ]
303
304 const items = [
305 `Do NOT use the ${BASH_TOOL_NAME} to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:`,
306 providedToolSubitems,
307 taskToolName
308 ? `Break down and manage your work with the ${taskToolName} tool. These tools are helpful for planning your work and helping the user track your progress. Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed.`
309 : null,
310 `You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead.`,
311 ].filter(item => item !== null)
312
313 return [`# Using your tools`, ...prependBullets(items)].join(`\n`)
314}
315
316function getAgentToolSection(): string {
317 return isForkSubagentEnabled()

Callers 1

getSystemPromptFunction · 0.85

Calls 4

isReplModeEnabledFunction · 0.85
prependBulletsFunction · 0.85
hasEmbeddedSearchToolsFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected