{"record":{"id":"b88e78b906749484","repo":"Hmbown/CodeWhale","slug":"missing-mcp-prefix","errorCode":null,"errorMessage":"missing mcp__ prefix","messagePattern":"missing mcp__ prefix","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mcp/src/lib.rs","lineNumber":692,"sourceCode":"        let remaining = component_budget - server_len - tool_len;\n        if remaining > 0 {\n            let server_extra = (server.len() - server_len).min(remaining);\n            server_len += server_extra;\n            tool_len += (tool.len() - tool_len).min(remaining - server_extra);\n        }\n        name = format!(\n            \"mcp__{}__{}{}\",\n            &server[..server_len],\n            &tool[..tool_len],\n            suffix\n        );\n    }\n    name\n}\n\nfn parse_qualified_tool_name(value: &str) -> Result<(String, String)> {\n    let Some(stripped) = value.strip_prefix(\"mcp__\") else {\n        bail!(\"missing mcp__ prefix\");\n    };\n    let mut split = stripped.splitn(2, \"__\");\n    let server = split\n        .next()\n        .filter(|s| !s.is_empty())\n        .map(ToOwned::to_owned)\n        .context(\"missing server segment\")?;\n    let tool = split\n        .next()\n        .filter(|s| !s.is_empty())\n        .map(ToOwned::to_owned)\n        .context(\"missing tool segment\")?;\n    Ok((server, tool))\n}\n\n#[derive(Debug, Deserialize)]\nstruct JsonRpcRequest {\n    jsonrpc: String,","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/mcp/src/lib.rs#L674-L710","documentation":"parse_qualified_tool_name splits strings of the form mcp__server__tool into (server, tool). If the input does not start with the literal 'mcp__' prefix, there is nothing to parse and the function bails with this message. It is the first validation gate for qualified tool names.","triggerScenarios":"Calling parse_qualified_tool_name (directly or via call_qualified_tool) with a string like \"github__search\", \"search\", or \"mcp-search\" that lacks the exact 'mcp__' prefix.","commonSituations":"Storing only the tool name and forgetting to qualify it before calling; hand-building qualified names with wrong separators (single underscore, hyphen); passing a tool name from a non-MCP source into the MCP qualified-name API.","solutions":["Prefix the tool name with 'mcp__' and the server segment: 'mcp__<server>__<tool>'.","Use the manager's qualification helper that builds the qualified name from (server, tool) instead of concatenating strings manually.","If the caller has unqualified names, resolve the server first and use call_tool(server, tool) instead of the qualified API."],"exampleFix":"// before\ncall_qualified_tool(\"github__search\")   // missing mcp__\n// after\ncall_qualified_tool(\"mcp__github__search\")","handlingStrategy":"validation","validationCode":"fn is_qualified_tool_name(s: &str) -> bool {\n    s.starts_with(\"mcp__\") && s[5..].split_once(\"__\")\n        .map(|(srv, tool)| !srv.is_empty() && !tool.is_empty())\n        .unwrap_or(false)\n}","typeGuard":"fn as_qualified(name: &str) -> Option<(&str, &str)> {\n    let rest = name.strip_prefix(\"mcp__\")?;\n    let (server, tool) = rest.split_once(\"__\")?;\n    (!server.is_empty() && !tool.is_empty()).then_some((server, tool))\n}","tryCatchPattern":null,"preventionTips":["Build qualified names with a helper (format!(\"mcp__{server}__{tool}\")), never by hand.","Store (server, tool) tuples and qualify at the call site.","Unit-test any name-building code against parse_qualified_tool_name round-trip."],"tags":["mcp","naming","format"],"backgroundTag":"invalid-identifier-format","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}