{"record":{"id":"4557a7da0acf0bcd","repo":"agentscope-ai/agentscope","slug":"invalid-values-for-mcp-card-name-r-e-message","errorCode":null,"errorMessage":"Invalid values for MCP {card.name!r}: {e.message}","messagePattern":"Invalid values for MCP (.+?): (.+?)","errorType":"exception","errorClass":"MCPRenderError","httpStatus":null,"severity":"error","filePath":"src/agentscope/app/_service/_mcp_render.py","lineNumber":132,"sourceCode":"            The user-supplied values keyed by input name.\n        name (`str | None`, optional):\n            The name for the installed client. Defaults to the card name.\n\n    Returns:\n        `MCPClient`:\n            The client ready to hand to ``workspace.add_mcp``.\n\n    Raises:\n        `MCPRenderError`:\n            When ``values`` violate the card's ``inputs_schema``, leave a\n            declared placeholder unfilled, or produce a config the\n            client rejects.\n    \"\"\"\n    values = _effective_values(card.inputs_schema, values)\n    try:\n        jsonschema.validate(values, card.inputs_schema)\n    except jsonschema.ValidationError as e:\n        raise MCPRenderError(\n            f\"Invalid values for MCP {card.name!r}: {e.message}\",\n        ) from e\n\n    declared = set(card.inputs_schema.get(\"properties\", {}))\n    required = set(card.inputs_schema.get(\"required\", []))\n    missing: set[str] = set()\n    config_template = card.config_template.model_dump(mode=\"json\")\n    _omit_unfilled_optional_env(\n        config_template,\n        values,\n        declared,\n        required,\n    )\n    config = _substitute(\n        config_template,\n        values,\n        declared,\n        missing,","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/app/_service/_mcp_render.py#L114-L150","documentation":"render_mcp validates the supplied input values against the MCP card's inputs_schema using jsonschema and raises MCPRenderError on the first validation failure. It means the values dict passed for the MCP server violates the card's declared schema (wrong types, unknown constrained values, etc.).","triggerScenarios":"Calling install_mcp or update_mcp (or render_mcp directly) with values that fail jsonschema validation against card.inputs_schema — e.g. a string where an integer is declared, an invalid enum member, or wrong nesting.","commonSituations":"Hand-writing MCP config values instead of using the form generated from the schema; version drift where an updated MCP card changed its inputs_schema; passing raw strings from environment variables into typed fields.","solutions":["Inspect card.inputs_schema (properties, types, enums) and correct the offending value","Validate values client-side with the same JSON Schema before calling install/update","Re-fetch the MCP card after upgrading to pick up schema changes","Use the rendered input form / defaults from the card rather than manual dicts"],"exampleFix":"# before\nclient = render_mcp(card, values={\"max_retries\": \"3\"})\n# after\nclient = render_mcp(card, values={\"max_retries\": 3})","handlingStrategy":"validation","validationCode":"import jsonschema\nvalues = _apply_defaults(card.inputs_schema, values)\njsonschema.validate(instance=values, schema=card.inputs_schema)  # run before install_mcp","typeGuard":"def values_match_schema(values: dict, schema: dict) -> bool:\n    try:\n        jsonschema.validate(values, schema)\n        return True\n    except jsonschema.ValidationError:\n        return False","tryCatchPattern":"try:\n    client = render_mcp(card, values)\nexcept MCPRenderError as e:\n    if e.args[0].startswith(\"Invalid values\"):\n        # surface schema errors to the form UI\n        ...","preventionTips":["Validate against card.inputs_schema client-side before submitting","Render forms from the card schema rather than hardcoding fields","Pin MCP card versions; re-fetch cards after upgrades"],"tags":["mcp","jsonschema","validation","render"],"backgroundTag":"schema-validation-failed","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}