ToolContext

Trait ToolContext 

Source
pub trait ToolContext {
    const NAME: &'static str;

    // Required method
    fn context(&self) -> &'static str;
}
Expand description

Trait for tools that provide usage context for LLM system prompts.

Implement this trait on tool types (for frameworks like rig) to enable automatic system prompt generation via SystemPromptBuilder.

§Example

use llm_coding_tools_core::context::ToolContext;

struct MyTool;

impl ToolContext for MyTool {
    const NAME: &'static str = "mytool";

    fn context(&self) -> &'static str {
        "Instructions for using MyTool..."
    }
}

Required Associated Constants§

Source

const NAME: &'static str

Tool name used for section headers in generated system prompt.

Should be lowercase (e.g., “read”, “bash”, “glob”). SystemPromptBuilder capitalizes this for display.

Required Methods§

Source

fn context(&self) -> &'static str

Returns the tool’s context string for system prompt generation.

This should return one of the context constants from this module.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§