Skip to content

Commit 7ffed0a

Browse files
committed
refactor!(tidb): remove --search-tool-prompt CLI option
Signed-off-by: Xin Liu <sam@secondstate.io>
1 parent a3444f8 commit 7ffed0a

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

cardea-tidb/cardea-tidb-mcp-server/src/main.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rmcp::transport::{
1111
};
1212
use rustls::crypto::{CryptoProvider, ring::default_provider};
1313
use std::{env, path::PathBuf};
14-
use tidb::{TidbServer, set_search_tool_prompt};
14+
use tidb::TidbServer;
1515
use tokio::sync::RwLock as TokioRwLock;
1616
use tracing::{error, info};
1717
use tracing_subscriber::{self, layer::SubscriberExt, util::SubscriberInitExt};
@@ -41,12 +41,6 @@ struct Args {
4141
/// Maximum number of query results to return
4242
#[arg(long, default_value = "10")]
4343
limit: u64,
44-
/// The prompt for the `search` mcp tool
45-
#[arg(
46-
long,
47-
default_value = "Please extract 3 to 5 keywords from my question, separated by spaces. Then, try to return a tool call that invokes the keyword search tool.\n\nMy question is: {query}"
48-
)]
49-
search_tool_prompt: String,
5044
}
5145

5246
#[derive(Debug, Clone, ValueEnum)]
@@ -125,9 +119,6 @@ async fn main() -> anyhow::Result<()> {
125119
.set(TokioRwLock::new(config))
126120
.map_err(|_| anyhow::anyhow!("Failed to set TIDB_ACCESS_CONFIG"))?;
127121

128-
// Set the search tool prompt from CLI
129-
set_search_tool_prompt(args.search_tool_prompt);
130-
131122
info!("Starting Cardea TiDB MCP server on {}", args.socket_addr);
132123

133124
match args.transport {

cardea-tidb/cardea-tidb-mcp-server/src/tidb.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rmcp::{
88
service::RequestContext,
99
tool, tool_handler, tool_router,
1010
};
11-
use std::{result::Result, sync::OnceLock};
11+
use std::result::Result;
1212
use tracing::{error, info};
1313

1414
const PROMPT_SEARCH_TOOL: &str = r#"
@@ -47,12 +47,6 @@ Examples:
4747
</tool_call>
4848
"#;
4949

50-
static SEARCH_TOOL_PROMPT: OnceLock<String> = OnceLock::new();
51-
52-
pub fn set_search_tool_prompt(prompt: String) {
53-
SEARCH_TOOL_PROMPT.set(prompt).unwrap_or_default();
54-
}
55-
5650
#[derive(Debug, Clone)]
5751
pub struct TidbServer {
5852
tool_router: ToolRouter<Self>,
@@ -257,8 +251,6 @@ impl ServerHandler for TidbServer {
257251
McpError::invalid_params("No query provided to `search` tool", None)
258252
})?;
259253

260-
// let prompt = SEARCH_TOOL_PROMPT.get().unwrap();
261-
// let prompt = prompt.replace("{query}", &query);
262254
let prompt = format!("{PROMPT_SEARCH_TOOL}\n\n### Input Query\n{query:#?}");
263255

264256
Ok(GetPromptResult {

0 commit comments

Comments
 (0)