llm-coding-tools-core
Lightweight, high-performance core types and utilities for coding tools - framework agnostic.
Overview
This crate provides the foundational building blocks for coding tool implementations:
ToolError- Unified error type for all tool operationsToolResult<T>- Result type alias using ToolErrorToolOutput- Wrapper for tool responses with truncation metadata- Utility functions for text processing and formatting
contextmodule - LLM guidance strings for tool usage
Features
tokio(default): Async mode with tokio runtime. Enables async function signatures.blocking: Sync/blocking mode. Mutually exclusive withtokio/async.async: Base async signatures (internal). Requires a runtime; usetokioinstead.
The async and blocking features are mutually exclusive - enabling both causes a compile error.
Future runtimes (smol, async-std) can be added following the same pattern as tokio.
Usage
use ;
use ;
Context Module
The context module provides embedded strings containing usage guidance for LLM agents.
These can be appended to tool descriptions or system prompts.
Path-based tools have two variants:
*_ABSOLUTE: For unrestricted filesystem access (absolute paths required)*_ALLOWED: For sandboxed access (paths relative to allowed directories)
use ;
// Non-path tools have a single variant
println!;
// Path-based tools have absolute and allowed variants
println!;
println!;
Available context strings:
BASH,TASK,TODO_READ,TODO_WRITE,WEBFETCH- standalone toolsREAD_ABSOLUTE,READ_ALLOWED- file readingWRITE_ABSOLUTE,WRITE_ALLOWED- file writingEDIT_ABSOLUTE,EDIT_ALLOWED- file editingGLOB_ABSOLUTE,GLOB_ALLOWED- pattern matchingGREP_ABSOLUTE,GREP_ALLOWED- content search
Design Principles
- No framework-specific dependencies, plug and play into any LLM framework/library
- See llm-coding-tools-rig for an integration example with rig
- Minimal dependency footprint
- Performance-oriented (optimized) with zero-cost abstractions