pub struct EnhancedPromptBuilder;Expand description
Builds enhanced prompt sections with tool usage guidelines
This builder constructs formatted markdown sections containing:
- Categorized tool guides with examples
- Best practices for tool usage
- Schema-only fallback for tools without guides
§Output Format
The generated prompts follow this structure:
## Tool Usage Guidelines
### File Reading Tools
Use these to inspect existing files and structure.
**read_file**
- When to use: Read file contents when you need to understand code
- When NOT to use: When you only need to check if a file exists
- Example: {"path": "/src/main.rs"} -> Reads the main source file
- Related tools: list_directory, search_files
### Best Practices
1. Always verify file paths before reading
2. Use appropriate tools for the taskImplementations§
Source§impl EnhancedPromptBuilder
impl EnhancedPromptBuilder
Sourcepub fn build(
registry: Option<&ToolRegistry>,
available_schemas: &[ToolSchema],
context: &GuideBuildContext,
) -> String
pub fn build( registry: Option<&ToolRegistry>, available_schemas: &[ToolSchema], context: &GuideBuildContext, ) -> String
Builds an enhanced prompt section for available tools
This method looks up guides for all provided schemas and generates a formatted markdown section with usage guidelines.
§Arguments
registry- Optional tool registry with registered guidesavailable_schemas- List of tool schemas to documentcontext- Build context (language, max examples, etc.)
§Returns
Formatted markdown string with tool usage guidelines
Sourcepub fn build_for_tools(
registry: Option<&ToolRegistry>,
tool_names: &[String],
fallback_schemas: &[ToolSchema],
context: &GuideBuildContext,
) -> String
pub fn build_for_tools( registry: Option<&ToolRegistry>, tool_names: &[String], fallback_schemas: &[ToolSchema], context: &GuideBuildContext, ) -> String
Builds an enhanced prompt for a specific set of tools
This method allows specifying exactly which tools to include, even if they’re not in the available schemas.
§Arguments
registry- Optional tool registry with registered guidestool_names- Specific tools to documentfallback_schemas- Schemas for tools without guidescontext- Build context (language, max examples, etc.)
§Returns
Formatted markdown string with tool usage guidelines
Auto Trait Implementations§
impl Freeze for EnhancedPromptBuilder
impl RefUnwindSafe for EnhancedPromptBuilder
impl Send for EnhancedPromptBuilder
impl Sync for EnhancedPromptBuilder
impl Unpin for EnhancedPromptBuilder
impl UnsafeUnpin for EnhancedPromptBuilder
impl UnwindSafe for EnhancedPromptBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more