{"record":{"id":"243f57acf23e8920","repo":"modelcontextprotocol/servers","slug":"missing-required-argument-timezone","errorCode":null,"errorMessage":"Missing required argument: timezone","messagePattern":"Missing required argument: timezone","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/time/src/mcp_server_time/server.py","lineNumber":192,"sourceCode":"                    readOnlyHint=True,\n                    destructiveHint=False,\n                    idempotentHint=True,\n                    openWorldHint=False,\n                ),\n            ),\n        ]\n\n    @server.call_tool()\n    async def call_tool(\n        name: str, arguments: dict\n    ) -> Sequence[TextContent | ImageContent | EmbeddedResource]:\n        \"\"\"Handle tool calls for time queries.\"\"\"\n        try:\n            match name:\n                case TimeTools.GET_CURRENT_TIME.value:\n                    timezone = arguments.get(\"timezone\")\n                    if not timezone:\n                        raise ValueError(\"Missing required argument: timezone\")\n\n                    result = time_server.get_current_time(timezone)\n\n                case TimeTools.CONVERT_TIME.value:\n                    if not all(\n                        k in arguments\n                        for k in [\"source_timezone\", \"time\", \"target_timezone\"]\n                    ):\n                        raise ValueError(\"Missing required arguments\")\n\n                    result = time_server.convert_time(\n                        arguments[\"source_timezone\"],\n                        arguments[\"time\"],\n                        arguments[\"target_timezone\"],\n                    )\n                case _:\n                    raise ValueError(f\"Unknown tool: {name}\")\n","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/modelcontextprotocol/servers/blob/76d64c822f5125032f89eb71dbdb94e42b434821/src/time/src/mcp_server_time/server.py#L174-L210","documentation":"The get_current_time branch (server.py:189-192) reads arguments.get('timezone') and raises ValueError('Missing required argument: timezone') when it is falsy (missing key, None, or empty string). NOTE: because the whole call_tool body is wrapped in except Exception (error 49), the specific message is masked and the client sees error 49's generic wrapper text instead.","triggerScenarios":"Calling get_current_time with no 'timezone' key, timezone: null, or timezone: ''.","commonSituations":"Client omits the key; an LLM emits null; the input schema is not enforced before dispatch; a UI sends an empty field.","solutions":["Always include a non-empty IANA timezone string in the arguments.","Validate against the tool's input schema before calling.","If you own the server, fix the outer except (error 49) so this real message survives to the client."],"exampleFix":"// before\n//   arguments: {}                       -> Missing required argument\n// after\n//   arguments: {\"timezone\": \"UTC\"}","handlingStrategy":"validation","validationCode":"tz = arguments.get(\"timezone\")\nif not isinstance(tz, str) or not tz.strip():\n    raise ValueError(\"'timezone' is required and must be a non-empty IANA name\")","typeGuard":"def has_timezone_arg(args: object) -> bool:\n    return (\n        isinstance(args, dict)\n        and isinstance(args.get(\"timezone\"), str)\n        and args[\"timezone\"].strip() != \"\"\n    )","tryCatchPattern":null,"preventionTips":["Enforce the JSON input schema client-side before dispatch.","Never rely on error 49's masked message; validate timezone presence yourself.","Treat null/empty timezone as a user-facing input error, not a server error."],"tags":["time","arguments","validation","python"],"backgroundTag":null,"analyzedSha":"76d64c822f5125032f89eb71dbdb94e42b434821","analyzedAt":"2026-08-12T10:02:41.718Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}