---
saw_name: "[SAW:wave1:agent-E] Part 1: Intent aliases (cmd/agent-lsp/tools_aliases.go)"
---

# Agent E Brief - Wave 1

**IMPL Doc:** /Users/dayna.blackwell/code/agent-lsp/docs/IMPL/IMPL-agent-dx-improvements.yaml

## Files Owned

- `cmd/agent-lsp/tools_aliases.go`
- `cmd/agent-lsp/tools_analysis.go`


## Task

## Agent E: Intent Aliases + Indexed Field in Analysis Responses

### What to Implement

**Part 1: Intent aliases (cmd/agent-lsp/tools_aliases.go)**

Create a new file registering alias tool names. Use `addToolWithPhaseCheck`.

Aliases:
- `blast_radius` -> same handler as `get_change_impact` (GetChangeImpactArgs)
- `callers` -> wraps find_callers, forces direction="incoming"
- `explore` -> calls `tools.HandleExploreSymbol` (GetInfoOnLocationArgs)
- `safe_edit` -> calls `tools.HandleSafeApplyEdit` (SafeApplyEditArgs)

Define `registerAliasTools(d toolDeps)`.

Note: `tools.HandleExploreSymbol` and `tools.HandleSafeApplyEdit` are created by
Agents B and C. Code compiles only after merge. Write correct references.

**Part 2: Add indexed field to analysis responses (cmd/agent-lsp/tools_analysis.go)**

Modify 3 tool handler wrappers to call `tools.AppendIndexedField`:
- `get_change_impact`
- `find_references`
- `find_symbol`

Change pattern:
```go
r, err := tools.HandleGetChangeImpact(ctx, d.cs.get(), toolArgsToMap(args))
r = tools.AppendIndexedField(r, d.cs.get())
return makeCallToolResult(r), nil, err
```

Note: `tools.AppendIndexedField` is created by Agent A. Compiles after merge.

### Verification Gate

```bash
go vet ./cmd/agent-lsp/ 2>&1 || true
```

Postconditions:
```bash
grep -c "blast_radius\|\"callers\"\|\"explore\"\|\"safe_edit\"" cmd/agent-lsp/tools_aliases.go
# Expected: >= 4
grep -c "AppendIndexedField" cmd/agent-lsp/tools_analysis.go
# Expected: >= 3
grep -c "func registerAliasTools" cmd/agent-lsp/tools_aliases.go
# Expected: 1
```

### Constraints
- Do NOT modify cmd/agent-lsp/tools_navigation.go
- Do NOT modify internal/tools/ files
- Do NOT modify cmd/agent-lsp/server.go (Wave 2)
- Do NOT modify files outside your ownership list



## Interface Contracts

### AppendIndexedField

Helper function that appends an "indexed" boolean field to tool response JSON.
Queries the LSP client's IsWorkspaceLoaded() and injects the field into the
response content's JSON object.


```
func AppendIndexedField(result types.ToolResult, client *lsp.LSPClient) types.ToolResult

```

### HandleExploreSymbol

Composite handler combining inspect_symbol + find_callers + get_symbol_source +
find_references into one call. Returns structured JSON with sections: type_info,
source, callers, references, test_callers.


```
func HandleExploreSymbol(ctx context.Context, client *lsp.LSPClient, args map[string]any) (types.ToolResult, error)

```

### HandleSafeApplyEdit

Combines preview_edit + apply_edit when net_delta == 0. Returns applied=true on
success or applied=false with preview diagnostics when net_delta > 0.


```
func HandleSafeApplyEdit(ctx context.Context, client *lsp.LSPClient, sessionMgr *session.SessionManager, args map[string]any) (types.ToolResult, error)

```

### getDiagnosticsForFile

Internal helper that retrieves diagnostics for a file and returns error/warning
counts. Used by symbol_edit handlers to auto-append diagnostic counts after edits.


```
func getDiagnosticsForFile(ctx context.Context, client *lsp.LSPClient, filePath string) (errors int, warnings int)

```



## Quality Gates

Level: standard

- **build**: `go build ./...` (required: true)
- **lint**: `go vet ./...` (required: true)
- **test**: `go test ./internal/... ./cmd/...` (required: true)

