一键导入
add-mcp-tool
Add a new MCP tool to the Context Keeper server. Use when adding a tool, implementing a new MCP capability, or extending the server's tool surface.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a new MCP tool to the Context Keeper server. Use when adding a tool, implementing a new MCP capability, or extending the server's tool surface.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add a new trait to context-keeper-core with a mock implementation. Use when adding a new abstraction, capability, or extension point to the core crate.
Start the Context Keeper MCP server locally for testing. Use when the user wants to run the stack, test MCP tools end-to-end, verify a build, smoke-test changes, or needs a live server to interact with.
Run the full Context Keeper test suite and diagnose failures. Use when the user asks to run tests, check if tests pass, verify changes didn't break anything, or troubleshoot test failures.
Workflow for picking up and implementing a Linear issue for Context Keeper. Use when starting work on an FZ-* issue, creating a feature branch, or following the project's branching and issue workflow.
| name | add-mcp-tool |
| description | Add a new MCP tool to the Context Keeper server. Use when adding a tool, implementing a new MCP capability, or extending the server's tool surface. |
In crates/context-keeper-mcp/src/tools.rs, add a new input struct near the other *Input types:
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct MyToolInput {
#[schemars(description = "Description shown to MCP clients")]
pub field: String,
#[schemars(description = "Optional field with default behavior")]
pub limit: Option<usize>,
}
Every field needs a #[schemars(description)] — this is what the MCP client sees.
Add a #[derive(Debug, Serialize)] struct if the response has structure beyond a simple string.
Add the method inside the #[tool_router] impl ContextKeeperServer block:
#[tool(description = "One-sentence description for the MCP tool listing")]
async fn my_tool(
&self,
Parameters(input): Parameters<MyToolInput>,
) -> Result<String, McpError> {
// Use self.repo, self.embedder, etc.
// Map errors with .map_err(|e| McpError::internal_error(format!("...: {e}"), None))
// Return JSON string
serde_json::to_string_pretty(&result)
.map_err(|e| McpError::internal_error(format!("Serialization failed: {e}"), None))
}
If the tool adds a new capability category, update the instructions string in get_info() at the bottom of tools.rs.
cargo build -p context-keeper-mcp
cargo test -p context-keeper-mcp
Then test with an MCP client (Claude Desktop, Cursor, or mcp-cli).
schemars::JsonSchema + descriptions on all fields#[tool(description = "...")] annotation with clear descriptionMcpError variants (not raw anyhow)