MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / dispatchTool

Function dispatchTool

compatible-shell/src/tools.mjs:168–183  ·  view source on GitHub ↗
({ workspaceDir, name, input, confirmShellCommand })

Source from the content-addressed store, hash-verified

166}
167
168async function dispatchTool({ workspaceDir, name, input, confirmShellCommand }) {
169 switch (name) {
170 case 'list_dir':
171 return listDir(workspaceDir, input)
172 case 'read_file':
173 return readFile(workspaceDir, input)
174 case 'write_file':
175 return writeFile(workspaceDir, input)
176 case 'search_text':
177 return searchText(workspaceDir, input)
178 case 'shell_command':
179 return runShellCommand(workspaceDir, input, confirmShellCommand)
180 default:
181 throw new Error(`Unsupported tool: ${name}`)
182 }
183}
184
185async function listDir(workspaceDir, input) {
186 const requestedPath = typeof input.path === 'string' && input.path ? input.path : '.'

Callers 1

executeToolCallsFunction · 0.85

Calls 5

listDirFunction · 0.85
readFileFunction · 0.85
writeFileFunction · 0.85
searchTextFunction · 0.85
runShellCommandFunction · 0.85

Tested by

no test coverage detected