{"record":{"id":"36d605d7e48aaf70","repo":"mastra-ai/mastra","slug":"mock-prompt-not-found-for-name","errorCode":null,"errorMessage":"Mock prompt not found for ${name}","messagePattern":"Mock prompt not found for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/__fixtures__/weather.ts","lineNumber":168,"sourceCode":"      return weatherResourceContents[uri];\n    }\n    throw new Error(`Mock resource content not found for ${uri}`);\n  },\n  resourceTemplates: async () => weatherResourceTemplatesDefinitions,\n};\n\nconst mcpServerPrompts: MCPServerPrompts = {\n  listPrompts: async () => weatherPrompts,\n  getPromptMessages: async ({\n    name,\n    version: _version,\n  }: {\n    name: string;\n    version?: string;\n  }): Promise<PromptMessage[]> => {\n    const content = weatherPromptContents[name];\n    if (!content) {\n      throw new Error(`Mock prompt not found for ${name}`);\n    }\n    return [\n      {\n        role: 'user',\n        content: {\n          type: 'text',\n          text: content,\n        },\n      },\n    ];\n  },\n};\n\nconst mcpServer = new MCPServer({\n  name: serverId,\n  version: '1.0.0',\n  tools: {\n    getWeather: weatherToolDefinition,","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/mcp/src/__fixtures__/weather.ts#L150-L186","documentation":"The mock MCP weather server fixture only defines a fixed set of prompt contents in its weatherPromptContents map. When getPrompt is called with a prompt name that is not a key of that map, the fixture throws this error instead of returning PromptMessage[]. It exists to fail fast in tests when a client requests a prompt the mock server never registered.","triggerScenarios":"Calling getPrompt() on the mock weather server with a name that is not present in weatherPromptContents — e.g. a typo in the prompt name, a prompt added to the server's prompt list but not to the contents map, or a test asserting a prompt the fixture does not implement.","commonSituations":"Test authors extending the weather fixture with a new prompt but forgetting to add its content; renaming a prompt in one place but not the other; copy-pasted test code referencing prompt names from a different fixture.","solutions":["Check the exact prompt name passed to getPrompt against the keys defined in weatherPromptContents in packages/mcp/src/__fixtures__/weather.ts and fix the typo","Add an entry to weatherPromptContents for the new prompt name being requested","Verify the mock server registers the prompt in its listPrompts handler so clients only request listed prompts"],"exampleFix":"// before\nawait server.getPrompt({ name: 'weather-forecat', arguments: {...} });\n// after\nawait server.getPrompt({ name: 'weather-forecast', arguments: {...} });","handlingStrategy":"validation","validationCode":"const available = Object.keys(weatherPromptContents);\nif (!available.includes(name)) {\n  throw new Error(`Unknown prompt '${name}'. Available: ${available.join(', ')}`);\n}\nawait server.getPrompt({ name });","typeGuard":"function isKnownPrompt(name: string): name is keyof typeof weatherPromptContents {\n  return name in weatherPromptContents;\n}","tryCatchPattern":null,"preventionTips":["Derive requested prompt names from the fixture's listPrompts output instead of hardcoding strings","Keep prompt names in a shared const/enum used by both the fixture list and tests","When adding a new prompt to the fixture, add its contents in the same commit"],"tags":["mcp","fixtures","test","prompt"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}