{"record":{"id":"31e32fbfb653fff6","repo":"modelcontextprotocol/servers","slug":"invalid-resourcetype-args-resourcetype-must","errorCode":null,"errorMessage":"Invalid resourceType: ${args?.resourceType}. Must be ${RESOURCE_TYPE_TEXT} or ${RESOURCE_TYPE_BLOB}.","messagePattern":"Invalid resourceType: (.+?)\\. Must be (.+?) or (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/everything/prompts/resource.ts","lineNumber":46,"sourceCode":"  };\n\n  // Register the prompt\n  server.registerPrompt(\n    \"resource-prompt\",\n    {\n      title: \"Resource Prompt\",\n      description: \"A prompt that includes an embedded resource reference\",\n      argsSchema: promptArgsSchema,\n    },\n    (args) => {\n      // Validate resource type argument\n      const resourceType = args.resourceType;\n      if (\n        !RESOURCE_TYPES.includes(\n          resourceType as typeof RESOURCE_TYPE_TEXT | typeof RESOURCE_TYPE_BLOB\n        )\n      ) {\n        throw new Error(\n          `Invalid resourceType: ${args?.resourceType}. Must be ${RESOURCE_TYPE_TEXT} or ${RESOURCE_TYPE_BLOB}.`\n        );\n      }\n\n      // Validate resourceId argument\n      const resourceId = Number(args?.resourceId);\n      if (\n        !Number.isFinite(resourceId) ||\n        !Number.isInteger(resourceId) ||\n        resourceId < 1\n      ) {\n        throw new Error(\n          `Invalid resourceId: ${args?.resourceId}. Must be a finite positive integer.`\n        );\n      }\n\n      // Get resource based on the resource type\n      const uri =","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/modelcontextprotocol/servers/blob/76d64c822f5125032f89eb71dbdb94e42b434821/src/everything/prompts/resource.ts#L28-L64","documentation":"Thrown by the `resource-prompt` handler in the Everything server when the `resourceType` prompt argument is not one of the two supported literals (`\"Text\"` or `\"Blob\"`). Prompt arguments arrive as strings (the MCP PromptArgument spec has no type field), so the server must validate the value manually before using it to build a resource URI. The check uses RESOURCE_TYPES.includes() against the runtime value.","triggerScenarios":"Calling the `resource-prompt` prompt with a `resourceType` argument that is neither `\"Text\"` nor `\"Blob\"` — e.g. `\"text\"` (lowercase), `\"file\"`, `undefined`, or an empty string. The completer suggests valid values but does not enforce them, so a raw prompt/get call bypassing completion can pass anything.","commonSituations":"Clients that lowercase the enum, LLMs paraphrasing the type, passing the literal string `resourceType` instead of its value, or omitting the argument entirely when no default exists (unlike the tool variant, the prompt schema has no default).","solutions":["Pass `resourceType` as exactly `\"Text\"` or `\"Blob\"` (capitalized) to the resource-prompt call.","If driving the call programmatically, source the value from the exported RESOURCE_TYPES constant rather than hardcoding.","Use the completion endpoint to discover accepted values before constructing the request."],"exampleFix":"// before\nserver.getPrompt('resource-prompt', { resourceType: 'text', resourceId: '1' });\n// after\nserver.getPrompt('resource-prompt', { resourceType: 'Text', resourceId: '1' });","handlingStrategy":"validation","validationCode":"import { RESOURCE_TYPES } from '../resources/templates.js';\nfunction isValidResourceType(v: unknown): boolean {\n  return typeof v === 'string' && RESOURCE_TYPES.includes(v);\n}\n// before calling the prompt:\nif (!isValidResourceType(args.resourceType)) {\n  args.resourceType = 'Text'; // or surface a user-facing error\n}","typeGuard":"function isResourceType(v: unknown): v is 'Text' | 'Blob' {\n  return v === 'Text' || v === 'Blob';\n}","tryCatchPattern":null,"preventionTips":["Source the resourceType value from the exported RESOURCE_TYPES constant rather than hardcoding.","Use the prompt completion endpoint to discover accepted values before issuing the call.","Treat prompt arguments as strings and validate before sending; the schema has no default."],"tags":["mcp","typescript","validation","everything-server","prompts"],"backgroundTag":null,"analyzedSha":"76d64c822f5125032f89eb71dbdb94e42b434821","analyzedAt":"2026-08-12T10:02:41.718Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}