Skip to content

tools: refactor into per-tool files with harness engineering tool surface - #16

Merged
changkun merged 1 commit into
mainfrom
changkun/sandbox-tools
Apr 8, 2026
Merged

tools: refactor into per-tool files with harness engineering tool surface#16
changkun merged 1 commit into
mainfrom
changkun/sandbox-tools

Conversation

@changkun

@changkun changkun commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Split monolithic tools.go and resources.go into individual per-tool files (tool_bash.go, tool_file_read.go, tool_file_edit.go, tool_file_write.go, tool_grep.go, tool_glob.go, tool_upload.go, tool_parse.go, server.go)
  • Add file_write tool for creating/overwriting files with automatic parent directory creation
  • Add bash_status tool and run_in_background / description parameters to bash
  • Add replace_all parameter to file_edit
  • Upgrade grep with output modes (content/files_with_matches/count), context lines, case-insensitive search, and head_limit
  • Upgrade glob to support recursive ** patterns with mtime-sorted results
  • Upgrade file_read with binary detection, base64 image content for image files, and PDF page range support
  • Add sandbox session persistence across server restarts via temp file and TENSORLAKE_SANDBOX_ID env var
  • Fix data: URI upload to properly parse and base64-decode standard data URIs
  • Add MCP progress notifications during long-running bash commands
  • Rewrite tool descriptions to instruct AI clients to prefer dedicated tools over bash (harness engineering pattern)
  • Add unit tests for pure functions (truncateOutput, isBinary, shellQuote, parseDataURI) and integration test coverage for all new features
  • Update README to document all tools, parameters, and new environment variables
  • Bump version to v0.3.0

Test plan

  • Unit tests pass without API key: go test -run 'TestTruncate|TestIsBinary|TestShellQuote|TestParseDataURI' ./...
  • Integration tests pass with API key: TENSORLAKE_API_KEY=... go test -v ./...
  • MCP Inspector shows all tools with correct schemas
  • Claude Desktop connects and uses tools correctly

…face

Split monolithic tools.go/resources.go into individual tool files and
add features to match harness engineering patterns:

- file_edit: add replace_all parameter
- file_write: new tool for creating/overwriting files with auto-mkdir
- file_read: binary/image detection, PDF page ranges, base64 image content
- grep: output modes, context lines, case-insensitive, head_limit
- glob: recursive ** patterns, mtime sorting
- bash: run_in_background with bash_status, description, progress notifications
- bash_status: new tool to check background command results
- server: sandbox session persistence across restarts (temp file + env var)
- upload: proper data: URI base64 decoding
- Tool descriptions instruct AI to prefer dedicated tools over bash
Comment thread server.go
// sessionFilePath returns a deterministic temp file path for persisting the sandbox ID.
// The path is keyed by API key hash so different accounts don't collide.
func sessionFilePath() string {
h := sha256.Sum256([]byte(tlAPIKey))
@changkun
changkun merged commit cdc7616 into main Apr 8, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants