MCPcopy Create free account
hub / github.com/dexwritescode/rust-mcp / create_module

Method create_module

src/server/handler.rs:718–750  ·  view source on GitHub ↗
(
        &self,
        Parameters(CreateModuleParams {
            module_name,
            module_path,
            is_public,
        }): Parameters<CreateModuleParams>,
    )

Source from the content-addressed store, hash-verified

716
717 #[tool(description = "Create a new Rust module with optional visibility")]
718 async fn create_module(
719 &self,
720 Parameters(CreateModuleParams {
721 module_name,
722 module_path,
723 is_public,
724 }): Parameters<CreateModuleParams>,
725 ) -> Result<CallToolResult, McpError> {
726 let args = serde_json::json!({
727 "module_name": module_name,
728 "module_path": module_path,
729 "is_public": is_public
730 });
731
732 let mut analyzer = self.analyzer.lock().await;
733 match execute_tool("create_module", args, &mut analyzer).await {
734 Ok(result) => {
735 if let Some(content) = result.content.first() {
736 if let Some(text) = content.get("text") {
737 return Ok(CallToolResult::success(vec![Content::text(
738 text.as_str().unwrap_or("No result"),
739 )]));
740 }
741 }
742 Ok(CallToolResult::success(vec![Content::text(
743 "Module created successfully",
744 )]))
745 }
746 Err(e) => Ok(CallToolResult::success(vec![Content::text(format!(
747 "Error: {e}"
748 ))])),
749 }
750 }
751
752 #[tool(description = "Move code items from one file to another")]
753 async fn move_items(

Callers

nothing calls this directly

Calls 1

execute_toolFunction · 0.85

Tested by

no test coverage detected