GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — claude-code-source-code/src/hooks/useMergedTools.ts at main · chaoswork/claude-code-source-code Expand file tree/ Copy pathuseMergedTools.tsMore file actions 44 lines (42 loc) · 1.61 KB / Copy pathuseMergedTools.tsFile metadata and controls44 lines (42 loc) · 1.61 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 // biome-ignore-all assist/source/organizeImports: ANT-ONLY import markers must not be reordered import { useMemo } from 'react' import type { Tools, ToolPermissionContext } from '../Tool.js' import { assembleToolPool } from '../tools.js' import { useAppState } from '../state/AppState.js' import { mergeAndFilterTools } from '../utils/toolPool.js' /** * React hook that assembles the full tool pool for the REPL. * * Uses assembleToolPool() (the shared pure function used by both REPL and runAgent) * to combine built-in tools with MCP tools, applying deny rules and deduplication. * Any extra initialTools are merged on top. * * @param initialTools - Extra tools to include (built-in + startup MCP from props). * These are merged with the assembled pool and take precedence in deduplication. * @param mcpTools - MCP tools discovered dynamically (from mcp state) * @param toolPermissionContext - Permission context for filtering */ export function useMergedTools( initialTools: Tools, mcpTools: Tools, toolPermissionContext: ToolPermissionContext, ): Tools { let replBridgeEnabled = false let replBridgeOutboundOnly = false return useMemo(() => { // assembleToolPool is the shared function that both REPL and runAgent use. // It handles: getTools() + MCP deny-rule filtering + dedup + MCP CLI exclusion. const assembled = assembleToolPool(toolPermissionContext, mcpTools) return mergeAndFilterTools( initialTools, assembled, toolPermissionContext.mode, ) }, [ initialTools, mcpTools, toolPermissionContext, replBridgeEnabled, replBridgeOutboundOnly, ]) } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |