[Phase 6.3] Tool Library #72

Closed
opened 2026-04-02 20:53:13 +00:00 by Mark · 0 comments
Owner

Overview

General-purpose tools for shell execution, HTTP requests, file operations, and database queries.

Problem Statement

Mesh can only generate text. Cannot:

  • Execute shell commands (run scripts, build code)
  • Call HTTP APIs (fetch data, POST results)
  • Read/write files directly (not via artifact system)
  • Query databases (get data for processing)
  • Interact with external systems

This makes mesh a text generator, not an agent that can actually do things.

Proposed Solution

6.3.1: Shell Command Tool

# tools/shell_command/template.yaml
tool:
  id: shell_command
  kind: python_function
  entrypoint: tools.shell_command.run:execute
  version: 1.0.0

io_schema:
  input:
    command: str  # Shell command to execute
    timeout: int = 30  # Max execution time
    cwd: str = None  # Working directory
    env: dict = {}  # Environment variables
  output:
    stdout: str
    stderr: str
    exit_code: int
    duration_ms: int

constraints:
  allowed_commands: ["ls", "cat", "git", "python", "npm", "docker"]  # Whitelist
  max_timeout: 300
  sandbox: true  # Run in isolated environment

6.3.2: HTTP Request Tool

# tools/http_request/template.yaml
tool:
  id: http_request
  kind: python_function
  entrypoint: tools.http_request.run:execute

io_schema:
  input:
    url: str
    method: str = "GET"  # GET, POST, PUT, DELETE
    headers: dict = {}
    body: str = None
    timeout: int = 30
  output:
    status_code: int
    headers: dict
    body: str
    duration_ms: int

constraints:
  allowed_domains: ["api.github.com", "slack.com"]  # Optional whitelist
  max_timeout: 60

6.3.3: File Operations Tool

# tools/file_ops/template.yaml
tool:
  id: file_ops
  kind: python_function
  entrypoint: tools.file_ops.run:execute

io_schema:
  input:
    operation: str  # read, write, append, delete, list
    path: str
    content: str = None  # For write/append
    encoding: str = "utf-8"
  output:
    content: str  # For read
    files: list  # For list
    bytes_written: int  # For write
    success: bool

constraints:
  allowed_paths: ["./workspace", "./artifacts"]  # Sandboxed paths
  max_file_size: 10MB

6.3.4: Database Query Tool

# tools/db_query/template.yaml
tool:
  id: db_query
  kind: python_function
  entrypoint: tools.db_query.run:execute

io_schema:
  input:
    connection: str  # Connection string or alias
    query: str  # SQL query
    params: dict = {}  # Query parameters
  output:
    rows: list
    row_count: int
    columns: list

constraints:
  read_only: true  # SELECT only by default
  allowed_tables: ["agents", "intents", "results"]

6.3.5: Tool Execution in Intents

# Intent using tools
intent_type: build_and_deploy
payload:
  steps:
    - tool: shell_command
      input: {command: "npm run build"}
    - tool: file_ops
      input: {operation: "read", path: "./dist/index.html"}
    - tool: http_request
      input: {url: "https://api.example.com/deploy", method: "POST"}

Deliverables

  • tools/shell_command/ - Shell execution tool
  • tools/http_request/ - HTTP client tool
  • tools/file_ops/ - File operations tool
  • tools/db_query/ - Database query tool
  • Tool execution in intent flow
  • Constraint enforcement (whitelists, timeouts)
  • Sandbox for shell commands
  • Unit tests per tool
  • Integration tests

Dependencies

  • None (standalone)

Estimated Duration

1 week

Success Criteria

  • Can execute whitelisted shell commands
  • Can make HTTP requests
  • Can read/write files in allowed paths
  • Can query database
  • Tools invoked via intent payload
  • Constraints enforced (security)
  • Parent: #69 (Phase 6 Meta)
## Overview General-purpose tools for shell execution, HTTP requests, file operations, and database queries. ## Problem Statement Mesh can only generate text. Cannot: - Execute shell commands (run scripts, build code) - Call HTTP APIs (fetch data, POST results) - Read/write files directly (not via artifact system) - Query databases (get data for processing) - Interact with external systems This makes mesh a text generator, not an agent that can actually *do* things. ## Proposed Solution ### 6.3.1: Shell Command Tool ```yaml # tools/shell_command/template.yaml tool: id: shell_command kind: python_function entrypoint: tools.shell_command.run:execute version: 1.0.0 io_schema: input: command: str # Shell command to execute timeout: int = 30 # Max execution time cwd: str = None # Working directory env: dict = {} # Environment variables output: stdout: str stderr: str exit_code: int duration_ms: int constraints: allowed_commands: ["ls", "cat", "git", "python", "npm", "docker"] # Whitelist max_timeout: 300 sandbox: true # Run in isolated environment ``` ### 6.3.2: HTTP Request Tool ```yaml # tools/http_request/template.yaml tool: id: http_request kind: python_function entrypoint: tools.http_request.run:execute io_schema: input: url: str method: str = "GET" # GET, POST, PUT, DELETE headers: dict = {} body: str = None timeout: int = 30 output: status_code: int headers: dict body: str duration_ms: int constraints: allowed_domains: ["api.github.com", "slack.com"] # Optional whitelist max_timeout: 60 ``` ### 6.3.3: File Operations Tool ```yaml # tools/file_ops/template.yaml tool: id: file_ops kind: python_function entrypoint: tools.file_ops.run:execute io_schema: input: operation: str # read, write, append, delete, list path: str content: str = None # For write/append encoding: str = "utf-8" output: content: str # For read files: list # For list bytes_written: int # For write success: bool constraints: allowed_paths: ["./workspace", "./artifacts"] # Sandboxed paths max_file_size: 10MB ``` ### 6.3.4: Database Query Tool ```yaml # tools/db_query/template.yaml tool: id: db_query kind: python_function entrypoint: tools.db_query.run:execute io_schema: input: connection: str # Connection string or alias query: str # SQL query params: dict = {} # Query parameters output: rows: list row_count: int columns: list constraints: read_only: true # SELECT only by default allowed_tables: ["agents", "intents", "results"] ``` ### 6.3.5: Tool Execution in Intents ```yaml # Intent using tools intent_type: build_and_deploy payload: steps: - tool: shell_command input: {command: "npm run build"} - tool: file_ops input: {operation: "read", path: "./dist/index.html"} - tool: http_request input: {url: "https://api.example.com/deploy", method: "POST"} ``` ## Deliverables - [ ] `tools/shell_command/` - Shell execution tool - [ ] `tools/http_request/` - HTTP client tool - [ ] `tools/file_ops/` - File operations tool - [ ] `tools/db_query/` - Database query tool - [ ] Tool execution in intent flow - [ ] Constraint enforcement (whitelists, timeouts) - [ ] Sandbox for shell commands - [ ] Unit tests per tool - [ ] Integration tests ## Dependencies - None (standalone) ## Estimated Duration 1 week ## Success Criteria - [ ] Can execute whitelisted shell commands - [ ] Can make HTTP requests - [ ] Can read/write files in allowed paths - [ ] Can query database - [ ] Tools invoked via intent payload - [ ] Constraints enforced (security) ## Related - Parent: #69 (Phase 6 Meta)
Mark closed this issue 2026-04-07 01:36:25 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/mesh-seed#72
No description provided.