{"record":{"id":"32ec43b7f2794548","repo":"apache/shardingsphere","slug":"unsupported-object-types-value-s","errorCode":null,"errorMessage":"Unsupported object_types value `%s`.","messagePattern":"Unsupported object_types value `(.+?)`\\.","errorType":"validation","errorClass":"MCPInvalidMetadataObjectTypesException","httpStatus":null,"severity":"error","filePath":"mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/tool/request/MCPToolArguments.java","lineNumber":81,"sourceCode":"        for (Object each : objectTypes) {\n            result.add(resolveObjectType(each, supportedObjectTypes));\n        }\n        return result;\n    }\n    \n    private SupportedMCPMetadataObjectType resolveObjectType(final Object objectType, final Set<SupportedMCPMetadataObjectType> supportedObjectTypes) {\n        String actualValue = Objects.toString(objectType, \"\").trim();\n        if (actualValue.isEmpty()) {\n            throw new MCPInvalidRequestException(\"object_types cannot contain blank values.\");\n        }\n        try {\n            SupportedMCPMetadataObjectType result = SupportedMCPMetadataObjectType.valueOf(actualValue.toUpperCase(Locale.ENGLISH));\n            if (supportedObjectTypes.contains(result)) {\n                return result;\n            }\n        } catch (final IllegalArgumentException ignored) {\n        }\n        throw new MCPInvalidMetadataObjectTypesException(actualValue, createAllowedObjectTypes(supportedObjectTypes));\n    }\n    \n    private List<String> createAllowedObjectTypes(final Set<SupportedMCPMetadataObjectType> supportedObjectTypes) {\n        return supportedObjectTypes.stream().map(each -> each.name().toLowerCase(Locale.ENGLISH)).toList();\n    }\n    \n    /**\n     * Get string argument.\n     *\n     * @param name argument name\n     * @return argument value\n     */\n    public String getStringArgument(final String name) {\n        return Objects.toString(arguments.get(name), \"\").trim();\n    }\n    \n    /**\n     * Get bounded integer argument.","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/mcp/core/src/main/java/org/apache/shardingsphere/mcp/core/tool/request/MCPToolArguments.java#L63-L99","documentation":"Thrown by MCPToolArguments.resolveObjectType as MCPInvalidMetadataObjectTypesException when an object_types entry is neither a valid SupportedMCPMetadataObjectType enum name (case-insensitive) nor one supported by the specific tool. The exception message interpolates the offending value and the exception carries the list of allowed values for the tool, so the caller can self-correct.","triggerScenarios":"SupportedMCPMetadataObjectType.valueOf(uppercased value) throws IllegalArgumentException, or the parsed enum is not in supportedObjectTypes for the current tool. Examples: \"tables\" (plural not matching the enum), \"index\" when the tool only supports table/view/schema, \"tbl\".","commonSituations":"Guessing type names (plural vs singular mismatches like tables/table); tool-specific support subsets — a value valid for one metadata tool rejected by another; version upgrades renaming enum constants.","solutions":["Read the allowed values from the exception payload (createAllowedObjectTypes lists them lowercased) and use exactly those","Use singular, lowercased enum-style names (e.g. table, view, schema) as emitted by the tool's descriptor","Fetch the tool's input schema/descriptor first and build validation from it dynamically"],"exampleFix":"// before\nlist_metadata({\"object_types\": [\"tables\"]})\n\n// after\nlist_metadata({\"object_types\": [\"table\"]})","handlingStrategy":"try-catch","validationCode":"// Validate against the tool descriptor's declared enum before calling\nSet<String> allowed = toolDescriptor.getAllowedObjectTypes(); // e.g. [table, view, schema]\nList<String> values = (List<String>) arguments.getOrDefault(\"object_types\", List.of());\nif (!allowed.containsAll(values.stream().map(v -> v.toLowerCase(Locale.ENGLISH)).toList())) {\n    throw new IllegalArgumentException(\"Allowed object_types: \" + allowed);\n}","typeGuard":"const ALLOWED = new Set([\"table\", \"view\", \"schema\"]); // sync from tool descriptor\nconst isValidObjectType = (v: unknown): v is string =>\n  typeof v === \"string\" && ALLOWED.has(v.trim().toLowerCase());","tryCatchPattern":"try {\n    listMetadata(arguments);\n} catch (MCPInvalidMetadataObjectTypesException e) {\n    // e lists allowed values; retry with the intersection\n    listMetadata(Map.of(\"object_types\", intersect(values, e.getAllowedObjectTypes())));\n}","preventionTips":["Use exact singular enum names (table, not tables) from the tool descriptor","Build validation dynamically from each tool's declared allowed values"],"tags":["mcp","request-validation","object-types","enum","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}