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

Function getToolsDescription

src/tools/AgentTool/prompt.ts:15–37  ·  view source on GitHub ↗
(agent: AgentDefinition)

Source from the content-addressed store, hash-verified

13import type { AgentDefinition } from './loadAgentsDir.js'
14
15function getToolsDescription(agent: AgentDefinition): string {
16 const { tools, disallowedTools } = agent
17 const hasAllowlist = tools && tools.length > 0
18 const hasDenylist = disallowedTools && disallowedTools.length > 0
19
20 if (hasAllowlist && hasDenylist) {
21 // Both defined: filter allowlist by denylist to match runtime behavior
22 const denySet = new Set(disallowedTools)
23 const effectiveTools = tools.filter(t => !denySet.has(t))
24 if (effectiveTools.length === 0) {
25 return 'None'
26 }
27 return effectiveTools.join(', ')
28 } else if (hasAllowlist) {
29 // Allowlist only: show the specific tools available
30 return tools.join(', ')
31 } else if (hasDenylist) {
32 // Denylist only: show "All tools except X, Y, Z"
33 return `All tools except ${disallowedTools.join(', ')}`
34 }
35 // No restrictions
36 return 'All tools'
37}
38
39/**
40 * Format one agent line for the agent_listing_delta attachment message:

Callers 1

formatAgentLineFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected