{"record":{"id":"7bc5d4e78be9fd2c","repo":"Hmbown/CodeWhale","slug":"mcp-prompt-prompt-name-was-not-advertised-by-s","errorCode":null,"errorMessage":"MCP prompt '{prompt_name}' was not advertised by server '{server_name}'","messagePattern":"MCP prompt '(.+?)' was not advertised by server '(.+?)'","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":3006,"sourceCode":"        let timeout = conn.config().effective_read_timeout(&global_timeouts);\n        conn.read_resource(uri, timeout).await\n    }\n\n    /// Get a prompt from a specific server\n    pub async fn get_prompt(\n        &mut self,\n        server_name: &str,\n        prompt_name: &str,\n        arguments: serde_json::Value,\n    ) -> Result<serde_json::Value> {\n        let global_timeouts = self.config.timeouts;\n        let conn = self.get_or_connect(server_name).await?;\n        if !conn\n            .prompts()\n            .iter()\n            .any(|prompt| prompt.name == prompt_name)\n        {\n            anyhow::bail!(\n                \"MCP prompt '{prompt_name}' was not advertised by server '{server_name}'\"\n            );\n        }\n        let timeout = conn.config().effective_execute_timeout(&global_timeouts);\n        conn.get_prompt(prompt_name, arguments, timeout).await\n    }\n\n    /// Parse a prefixed name into (server_name, tool_name)\n    pub(crate) fn parse_prefixed_name(&self, prefixed_name: &str) -> Result<(String, String)> {\n        let Some(rest) = prefixed_name.strip_prefix(\"mcp_\") else {\n            anyhow::bail!(\"Invalid MCP tool name: {prefixed_name}\");\n        };\n\n        let mut matched: Option<(String, String)> = None;\n        for (server, connection) in &self.connections {\n            if !connection.catalog_authorized() {\n                continue;\n            }","sourceCodeStart":2988,"sourceCodeEnd":3024,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/mcp.rs#L2988-L3024","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\npool.get_prompt(\"docs\", \"sumarize\", json!({})).await?;\n// Err: 'MCP prompt ... was not advertised' (actual name: 'summarize')\n\n// after\nlet names: Vec<_> = pool.get_or_connect(\"docs\").await?.prompts().iter().map(|p| p.name.clone()).collect();\n// pick from `names`, then:\npool.get_prompt(\"docs\", \"summarize\", json!({})).await?;","handlingStrategy":"validation","validationCode":"// Rust: check the prompt is advertised before requesting it\nlet conn = pool.get_or_connect(server).await?;\nensure!(\n    conn.prompts().iter().any(|p| p.name == prompt),\n    \"prompt '{prompt}' not advertised by '{server}'\"\n);\nlet value = pool.get_prompt(server, prompt, args).await?;","typeGuard":null,"tryCatchPattern":"// Rust: on failure, suggest the real prompt names\nmatch pool.get_prompt(server, prompt, args).await {\n    Err(e) if e.to_string().contains(\"was not advertised\") => {\n        let names: Vec<_> = pool.get_or_connect(server).await?.prompts().iter().map(|p| p.name.clone()).collect();\n        bail!(\"unknown prompt; advertised: {}\", names.join(\", \"))\n    }\n    o => o,\n}","preventionTips":["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."],"tags":["mcp","prompts","validation","naming"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}