Expand description
Tool context strings for LLM agents.
These provide usage guidance, best practices, and behavioral instructions for LLM agents when using coding tools. Context strings are sourced from OpenCode’s tool documentation.
§Path-based Tools
Tools operating on file paths have two variants:
*_ABSOLUTE: For unrestricted filesystem access (absolute paths required)*_ALLOWED: For sandboxed access (paths relative to allowed directories)
§Example
use llm_coding_tools_core::context::{BASH, READ_ABSOLUTE, READ_ALLOWED};
// Use BASH context for bash tool
println!("Bash guidance: {}", BASH);
// Use appropriate read context based on path resolver
let sandboxed = true;
let read_context = if sandboxed { READ_ALLOWED } else { READ_ABSOLUTE };Constants§
- BASH
- Bash tool context - shell command execution guidance.
- EDIT_
ABSOLUTE - Edit tool context for absolute path mode.
- EDIT_
ALLOWED - Edit tool context for allowed/sandboxed path mode.
- GITHUB_
CLI - GitHub CLI context - gh command usage guidance.
- GIT_
WORKFLOW - Git workflow context - commit creation guidance.
- GLOB_
ABSOLUTE - Glob tool context for absolute path mode.
- GLOB_
ALLOWED - Glob tool context for allowed/sandboxed path mode.
- GREP_
ABSOLUTE - Grep tool context for absolute path mode.
- GREP_
ALLOWED - Grep tool context for allowed/sandboxed path mode.
- READ_
ABSOLUTE - Read tool context for absolute path mode.
- READ_
ALLOWED - Read tool context for allowed/sandboxed path mode.
- TODO_
READ - Todo read tool context - reading task lists.
- TODO_
WRITE - Todo write tool context - managing task lists.
- WEBFETCH
- Webfetch tool context - URL content retrieval.
- WRITE_
ABSOLUTE - Write tool context for absolute path mode.
- WRITE_
ALLOWED - Write tool context for allowed/sandboxed path mode.
Traits§
- Tool
Context - Trait for tools that provide usage context for LLM system prompts.