MCPcopy Create free account
hub / github.com/anomalyco/opencode / toLocations

Function toLocations

packages/opencode/src/acp/tool.ts:73–101  ·  view source on GitHub ↗
(toolName: string, input: ToolInput, cwd?: string)

Source from the content-addressed store, hash-verified

71}
72
73export function toLocations(toolName: string, input: ToolInput, cwd?: string): ToolCallLocation[] {
74 const tool = toolName.toLocaleLowerCase()
75
76 switch (tool) {
77 case "bash":
78 case "shell": {
79 const workdir = shellWorkdir(input, cwd)
80 return workdir ? [{ path: workdir }] : []
81 }
82
83 case "read":
84 case "edit":
85 case "write":
86 return locationFrom(input.filePath ?? input.filepath)
87
88 case "external_directory":
89 return locationFrom(input.filePath ?? input.filepath, input.parentDir, input.directories)
90
91 case "grep":
92 case "glob":
93 case "context":
94 case "context7_resolve_library_id":
95 case "context7_get_library_docs":
96 return locationFrom(input.path)
97
98 default:
99 return []
100 }
101}
102
103export function completedToolContent(toolName: string, state: CompletedToolState): ToolCallContent[] {
104 const text =

Callers 6

tool.test.tsFile · 0.90
permissionLocationsFunction · 0.90
pendingToolCallFunction · 0.85
runningToolUpdateFunction · 0.85
errorToolUpdateFunction · 0.85

Calls 2

shellWorkdirFunction · 0.85
locationFromFunction · 0.85

Tested by

no test coverage detected