MCPcopy Index your code
hub / github.com/Noumena-Network/code / getTools

Function getTools

src/tools.ts:299–332  ·  view source on GitHub ↗
(permissionContext: ToolPermissionContext)

Source from the content-addressed store, hash-verified

297}
298
299export const getTools = (permissionContext: ToolPermissionContext): Tools => {
300 // Simple mode: only Bash, Read, and Edit tools
301 if (isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) {
302 const simpleTools: Tool[] = [BashTool, FileReadTool, FileEditTool]
303 if (isReplModeEnabled() && REPLTool) {
304 simpleTools.push(REPLTool)
305 }
306 // When coordinator mode is also active, include AgentTool and TaskStopTool
307 // so the coordinator gets Task+TaskStop (via useMergedTools filtering) and
308 // workers get Bash/Read/Edit (via filterToolsForAgent filtering).
309 if (
310 feature('COORDINATOR_MODE') &&
311 coordinatorModeModule?.isCoordinatorMode()
312 ) {
313 simpleTools.push(AgentTool, TaskStopTool, getSendMessageTool())
314 }
315 return sortToolsByPolicy(filterToolsByDenyRules(simpleTools, permissionContext))
316 }
317
318 // Get all base tools and filter out special tools that get added conditionally
319 const specialTools = new Set([
320 ListMcpResourcesTool.name,
321 ReadMcpResourceTool.name,
322 SYNTHETIC_OUTPUT_TOOL_NAME,
323 ])
324
325 const tools = getAllBaseTools().filter(tool => !specialTools.has(tool.name))
326
327 // Filter out tools that are denied by the deny rules
328 const allowedTools = filterToolsByDenyRules(tools, permissionContext)
329
330 const isEnabled = allowedTools.map(_ => _.isEnabled())
331 return sortToolsByPolicy(allowedTools.filter((_, i) => isEnabled[i]))
332}
333
334/**
335 * Assemble the full tool pool for a given permission context and MCP tools.

Callers 12

assembleToolPoolFunction · 0.85
getMergedToolsFunction · 0.85
runFunction · 0.85
collectToolInventoryFunction · 0.85
toolPolicy.test.tsFile · 0.85
AsyncAgentDetailDialogFunction · 0.85
logContextMetricsFunction · 0.85
callFunction · 0.85
callFunction · 0.85
REPLFunction · 0.85
startMCPServerFunction · 0.85

Calls 7

isEnvTruthyFunction · 0.90
isReplModeEnabledFunction · 0.85
getSendMessageToolFunction · 0.85
sortToolsByPolicyFunction · 0.85
filterToolsByDenyRulesFunction · 0.85
getAllBaseToolsFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected