Hmbown/CodeWhale · error · anyhow::Error
MCP prompt '{prompt_name}' was not advertised by server '{se
Error message
MCP prompt '{prompt_name}' was not advertised by server '{server_name}' What it means
get_prompt (the guarded prompt path) checks prompt_name against the connection's advertised prompts (prompts/list catalog) before forwarding the getPrompt request. A name not in conn.prompts() is rejected locally — the server is never asked — mirroring the resource-URI guard and preventing requests for prompts outside the server's declared surface.
Source
Thrown at crates/tui/src/mcp.rs:3006
let timeout = conn.config().effective_read_timeout(&global_timeouts);
conn.read_resource(uri, timeout).await
}
/// Get a prompt from a specific server
pub async fn get_prompt(
&mut self,
server_name: &str,
prompt_name: &str,
arguments: serde_json::Value,
) -> Result<serde_json::Value> {
let global_timeouts = self.config.timeouts;
let conn = self.get_or_connect(server_name).await?;
if !conn
.prompts()
.iter()
.any(|prompt| prompt.name == prompt_name)
{
anyhow::bail!(
"MCP prompt '{prompt_name}' was not advertised by server '{server_name}'"
);
}
let timeout = conn.config().effective_execute_timeout(&global_timeouts);
conn.get_prompt(prompt_name, arguments, timeout).await
}
/// Parse a prefixed name into (server_name, tool_name)
pub(crate) fn parse_prefixed_name(&self, prefixed_name: &str) -> Result<(String, String)> {
let Some(rest) = prefixed_name.strip_prefix("mcp_") else {
anyhow::bail!("Invalid MCP tool name: {prefixed_name}");
};
let mut matched: Option<(String, String)> = None;
for (server, connection) in &self.connections {
if !connection.catalog_authorized() {
continue;
}View on GitHub (pinned to 8880682c63)
Solutions
- List the server's prompts first (conn.prompts() or the prompt-listing tool) and pass an exact name from it.
- Refresh the connection (reconnect) if the server's prompt set may have changed since the catalog was fetched.
- Check spelling and case — matching is exact on prompt.name.
- Confirm you're targeting the right server name for that prompt.
Example fix
// before
pool.get_prompt("docs", "sumarize", json!({})).await?;
// Err: 'MCP prompt ... was not advertised' (actual name: 'summarize')
// after
let names: Vec<_> = pool.get_or_connect("docs").await?.prompts().iter().map(|p| p.name.clone()).collect();
// pick from `names`, then:
pool.get_prompt("docs", "summarize", json!({})).await?; Defensive patterns
Strategy: validation
Validate before calling
// Rust: check the prompt is advertised before requesting it
let conn = pool.get_or_connect(server).await?;
ensure!(
conn.prompts().iter().any(|p| p.name == prompt),
"prompt '{prompt}' not advertised by '{server}'"
);
let value = pool.get_prompt(server, prompt, args).await?; Try / catch
// Rust: on failure, suggest the real prompt names
match pool.get_prompt(server, prompt, args).await {
Err(e) if e.to_string().contains("was not advertised") => {
let names: Vec<_> = pool.get_or_connect(server).await?.prompts().iter().map(|p| p.name.clone()).collect();
bail!("unknown prompt; advertised: {}", names.join(", "))
}
o => o,
} Prevention
- List prompts before calling; names are exact and case-sensitive.
- After server upgrades, re-list prompts — names change.
- Make the model use the prompt-listing tool rather than guessing names.
When it happens
Trigger: Calling the prompt API with a prompt name that is misspelled, removed on the server, or only present on a different server; also stale catalogs where the client remembered a prompt from before a server update.
Common situations: The model guesses prompt names instead of listing them first; server upgrades rename or delete prompts; multiple servers expose similarly named prompts and the caller targeted the wrong one; case mismatches.
Related errors
- Invalid MCP tool name: {prefixed_name}
- MCP config path cannot be empty
- MCP config path cannot contain '..' components
- invalid environment placeholder in MCP config value
- reviewed plugin MCP endpoint must not contain user informati
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/7bc5d4e78be9fd2c.
Report an issue: GitHub.