(toolName: string, input: ToolInput, cwd?: string)
| 71 | } |
| 72 | |
| 73 | export 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 | |
| 103 | export function completedToolContent(toolName: string, state: CompletedToolState): ToolCallContent[] { |
| 104 | const text = |
no test coverage detected