{"record":{"id":"3568c2e302715a11","repo":"rohitg00/ai-engineering-from-scratch","slug":"unknown-prompt","errorCode":null,"errorMessage":"unknown prompt","messagePattern":"unknown prompt","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"certifications/claude/lessons/11-mcp-server-design-and-integration/code/main.py","lineNumber":295,"sourceCode":"                    }\n                ],\n                ttlMs=30_000,\n                cacheScope=\"private\",\n            ), []\n        if method == \"prompts/list\":\n            prompts = [\n                {\"name\": name, \"description\": self.prompts[name]}\n                for name in sorted(self.prompts)\n            ]\n            return self._complete(\n                prompts=prompts, ttlMs=300_000, cacheScope=\"public\"\n            ), []\n        if method == \"prompts/get\":\n            name = params[\"name\"]\n            if not isinstance(name, str):\n                raise ValueError(\"name must be a string\")\n            if name not in self.prompts:\n                raise ValueError(\"unknown prompt\")\n            return self._complete(\n                messages=[\n                    {\n                        \"role\": \"user\",\n                        \"content\": {\"type\": \"text\", \"text\": self.prompts[name]},\n                    }\n                ]\n            ), []\n        raise LookupError(f\"Method not found: {method}\")\n\n    def _call_tool(\n        self, params: dict[str, Any], metadata: dict[str, Any]\n    ) -> tuple[dict[str, Any], list[dict[str, Any]]]:\n        name = params[\"name\"]\n        if not isinstance(name, str) or not name:\n            raise ValueError(\"name must be a non-empty string\")\n        tool = self.tools.get(name)\n        if tool is None:","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/certifications/claude/lessons/11-mcp-server-design-and-integration/code/main.py#L277-L313","documentation":"The name passed to prompts/get is a string but is not a key in the server's self.prompts registry. The simulator registers a fixed set of prompt templates at construction; anything else is unknown. Enumerate valid names first via prompts/list, whose response contains each prompt's exact name.","triggerScenarios":"prompts/get with \"summarize\" when the registry only has \"summarise\" or \"summary\"; hardcoding a prompt name removed in a server update; querying prompts that exist on a different MCP server.","commonSituations":"Prompt catalogs renamed between versions; multi-server setups where a name is routed to the wrong server; docs referencing prompts this deployment does not install.","solutions":["Call prompts/list and use a name from the response exactly as returned","Copy the name character-for-character — no renaming, casing changes, or pluralization","If a needed prompt is missing, register it server-side or update the client's expected catalog"],"exampleFix":"# before\nserver.exchange(\"prompts/get\", {\"name\": \"sumarize\", \"_meta\": meta})\n# after\nlisted = server.exchange(\"prompts/list\", {\"_meta\": meta})[0]\nname = listed[\"prompts\"][0][\"name\"]\nserver.exchange(\"prompts/get\", {\"name\": name, \"_meta\": meta})","handlingStrategy":"validation","validationCode":"listed = server.exchange(\"prompts/list\", {\"_meta\": meta})[0]\nnames = {p[\"name\"] for p in listed[\"prompts\"]}\nif name not in names:\n    raise LookupError(f\"unknown prompt {name!r}; known: {sorted(names)}\")","typeGuard":"def prompt_exists(server, name: str) -> bool:\n    return name in getattr(server, \"prompts\", {})","tryCatchPattern":"try:\n    server.exchange(\"prompts/get\", params)\nexcept ValueError as e:\n    if str(e) == \"unknown prompt\":\n        params[\"name\"] = pick_from_prompts_list()  # reselect and retry once\n    else:\n        raise","preventionTips":["Discover prompt names via prompts/list and reference them verbatim","Version your prompt catalog so client and server rename together","Fail fast client-side with the known-name list instead of a server round trip"],"tags":["mcp","prompts","unknown-name","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}