| 381 | type EmptyInput struct{} |
| 382 | |
| 383 | func handleStatus(ctx context.Context, req *mcp.CallToolRequest, input EmptyInput) (*mcp.CallToolResult, any, error) { |
| 384 | cwd, _ := os.Getwd() |
| 385 | home := os.Getenv("HOME") |
| 386 | |
| 387 | // Check active watchers |
| 388 | watchersMu.RLock() |
| 389 | activeWatchers := len(watchers) |
| 390 | var watchedPaths []string |
| 391 | for path := range watchers { |
| 392 | watchedPaths = append(watchedPaths, path) |
| 393 | } |
| 394 | watchersMu.RUnlock() |
| 395 | |
| 396 | watchStatus := "none" |
| 397 | if activeWatchers > 0 { |
| 398 | watchStatus = fmt.Sprintf("%d active: %s", activeWatchers, strings.Join(watchedPaths, ", ")) |
| 399 | } |
| 400 | |
| 401 | return textResult(fmt.Sprintf(`codemap MCP server v2.1.0 |
| 402 | Status: connected |
| 403 | Local filesystem access: enabled |
| 404 | Working directory: %s |
| 405 | Home directory: %s |
| 406 | Active watchers: %s |
| 407 | |
| 408 | Available tools: |
| 409 | list_projects - Discover projects in a directory |
| 410 | get_structure - Project tree view |
| 411 | get_dependencies - Import/function analysis |
| 412 | get_diff - Changed files vs branch |
| 413 | find_file - Search by filename |
| 414 | get_importers - Find what imports a file |
| 415 | get_handoff - Build/read cross-agent handoff summary |
| 416 | |
| 417 | Live watch tools: |
| 418 | start_watch - Start watching a project for changes |
| 419 | stop_watch - Stop watching a project |
| 420 | get_activity - See recent coding activity (hot files, edits, timeline)`, cwd, home, watchStatus)), nil, nil |
| 421 | } |
| 422 | |
| 423 | func handleListProjects(ctx context.Context, req *mcp.CallToolRequest, input ListProjectsInput) (*mcp.CallToolResult, any, error) { |
| 424 | // Expand ~ to home directory |