Code Walkthrough Tools
present_walkthrough
#![allow(unused)] fn main() { // --- Parameters ----------------------- #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)] pub struct PresentWalkthroughParams { /// Markdown content with embedded XML elements (comment, gitdiff, action, mermaid) /// See dialectic guidance for XML element syntax and usage pub content: String, /// Base directory path for resolving relative file references #[serde(rename = "baseUri")] pub base_uri: String, } // --- Tool definition ------------------ #[tool( description = "\ Display a code walkthrough in the user's IDE.\n\ Use this when the user\n\ (1) requests a walkthrough or that you walk through code or\n\ (2) asks that you explain how code works.\n\ \n\ Accepts markdown content with special code blocks.\n\ \n\ To find full guidelines for usage, use the `expand_reference` with `walkthrough-format.md`.\n\ \n\ Quick tips:\n\ \n\ Display a mermaid graph:\n\ ```mermaid\n\ (Mermaid content goes here)\n\ ```\n\ \n\ Add a comment to a particular line of code:\n\ ```comment\n\ location: findDefinition(`symbol_name`)\n\ \n\ (Explanatory text goes here)\n\ ```\n\ \n\ Add buttons that will let the user send you a message:\n\ ```action\n\ button: (what the user sees)\n\ \n\ (what message you will get)\n\ ```\n\ " )] async fn present_walkthrough( &self, Parameters(params): Parameters<PresentWalkthroughParams>, ) -> Result<CallToolResult, McpError> { }
Supported XML elements:
<comment location="EXPR" icon="ICON">content</comment>
- Code comments at specific locations<action button="TEXT">message</action>
- Interactive buttons<mermaid>diagram</mermaid>
- Architecture diagrams
Use case: Create interactive code tours and explanations