{"record":{"id":"6771f5a4b36dcf78","repo":"alibaba/nacos","slug":"10000-6771f5","errorCode":"10000","errorMessage":"Required parameter 'mcpId' or 'mcpName' type String at lease one is not present","messagePattern":"Required parameter 'mcpId' or 'mcpName' type String at lease one is not present","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/mcp/admin/McpForm.java","lineNumber":50,"sourceCode":" */\npublic class McpForm implements NacosForm {\n    \n    @Serial\n    private static final long serialVersionUID = 1314659974972866397L;\n    \n    private String mcpId;\n    \n    private String namespaceId;\n    \n    private String mcpName;\n    \n    private String version;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultValue();\n        if (StringUtils.isEmpty(mcpId) && StringUtils.isEmpty(mcpName)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'mcpId' or 'mcpName' type String at lease one is not present\");\n        }\n    }\n    \n    protected void fillDefaultValue() {\n        if (StringUtils.isEmpty(namespaceId)) {\n            namespaceId = AiConstants.Mcp.MCP_DEFAULT_NAMESPACE;\n        }\n    }\n    \n    public String getNamespaceId() {\n        return namespaceId;\n    }\n    \n    public void setNamespaceId(String namespaceId) {\n        this.namespaceId = namespaceId;\n    }\n    ","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/mcp/admin/McpForm.java#L32-L68","documentation":"Thrown by McpForm.validate() when BOTH mcpId and mcpName are empty. The form requires at least one identifier to resolve an MCP server (id is preferred, name is the fallback). namespaceId defaults to the MCP default namespace. Maps to code 10000 (PARAMETER_MISSING), HTTP 400.","triggerScenarios":"Calling GET /v3/admin/ai/mcp (get server detail) or DELETE /v3/admin/ai/mcp (delete) without either mcpId or mcpName.","commonSituations":"Client assumes name is enough but sends it under `name` instead of `mcpName`; a deletion script passes an empty id after a failed lookup; refactoring renames the field on the caller side.","solutions":["Provide at least one of mcpId or mcpName in the request.","Prefer mcpId for unambiguous targeting; fall back to mcpName+namespaceId.","Double-check the exact field names (mcpId / mcpName), not generic name/id."],"exampleFix":"// before\ncurl -X DELETE 'http://host/v3/admin/ai/mcp'\n// after\ncurl -X DELETE 'http://host/v3/admin/ai/mcp' -d 'mcpName=myMcp&namespaceId=public'","handlingStrategy":"validation","validationCode":"if ((mcpId == null || mcpId.isEmpty()) && (mcpName == null || mcpName.isEmpty())) {\n    throw new IllegalArgumentException(\"mcpId or mcpName required\");\n}","typeGuard":"static boolean hasMcpIdentifier(String id, String name) {\n    return (id != null && !id.isEmpty()) || (name != null && !name.isEmpty());\n}","tryCatchPattern":"catch (NacosApiException e) {\n    if (e.getErrCode() == 10000 && e.getMessage().contains(\"mcpId\")) { /* supply id or name */ }\n}","preventionTips":["Always resolve and send mcpId when available.","Fall back to mcpName+namespaceId only when id is unknown."],"tags":["validation","ai","mcp","parameter","http","api"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}