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§

Source§

impl ToolContext for llm_coding_tools_rig::absolute::EditTool

Source§

const NAME: &'static str = tool_names::EDIT

Source§

impl ToolContext for llm_coding_tools_rig::absolute::GlobTool

Source§

const NAME: &'static str = tool_names::GLOB

Source§

impl ToolContext for llm_coding_tools_rig::absolute::WriteTool

Source§

const NAME: &'static str = tool_names::WRITE

Source§

impl ToolContext for llm_coding_tools_rig::allowed::EditTool

Source§

const NAME: &'static str = tool_names::EDIT

Source§

impl ToolContext for llm_coding_tools_rig::allowed::GlobTool

Source§

const NAME: &'static str = tool_names::GLOB

Source§

impl ToolContext for llm_coding_tools_rig::allowed::WriteTool

Source§

const NAME: &'static str = tool_names::WRITE

Source§

impl ToolContext for BashTool

Source§

const NAME: &'static str = tool_names::BASH

Source§

impl ToolContext for TodoReadTool

Source§

const NAME: &'static str = tool_names::TODO_READ

Source§

impl ToolContext for TodoWriteTool

Source§

const NAME: &'static str = tool_names::TODO_WRITE

Source§

impl ToolContext for WebFetchTool

Source§

const NAME: &'static str = tool_names::WEBFETCH

Source§

impl<const LINE_NUMBERS: bool> ToolContext for llm_coding_tools_rig::absolute::GrepTool<LINE_NUMBERS>

Source§

const NAME: &'static str = tool_names::GREP

Source§

impl<const LINE_NUMBERS: bool> ToolContext for llm_coding_tools_rig::absolute::ReadTool<LINE_NUMBERS>

Source§

const NAME: &'static str = tool_names::READ

Source§

impl<const LINE_NUMBERS: bool> ToolContext for llm_coding_tools_rig::allowed::GrepTool<LINE_NUMBERS>

Source§

const NAME: &'static str = tool_names::GREP

Source§

impl<const LINE_NUMBERS: bool> ToolContext for llm_coding_tools_rig::allowed::ReadTool<LINE_NUMBERS>

Source§

const NAME: &'static str = tool_names::READ