{"record":{"id":"4cba4a5c9897c232","repo":"rohitg00/ai-engineering-from-scratch","slug":"32602-4cba4a","errorCode":"-32602","errorMessage":"params must be an object","messagePattern":"params must be an object","errorType":"exception","errorClass":"RpcProblem","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/13-mcp-server-with-registry/code/ts/src/protocol.ts","lineNumber":119,"sourceCode":"function complete(\n  payload: Record<string, unknown>,\n  cache?: { ttlMs: number; cacheScope: \"public\" | \"private\" },\n): Record<string, unknown> {\n  const result: Record<string, unknown> = {\n    resultType: \"complete\",\n    ...payload,\n    _meta: { [SERVER_INFO_KEY]: { ...SERVER_INFO } },\n  };\n  if (cache) {\n    result.ttlMs = cache.ttlMs;\n    result.cacheScope = cache.cacheScope;\n  }\n  return result;\n}\n\nfunction validateRequest(msg: JsonRpcRequest): Record<string, unknown> {\n  if (!isRecord(msg.params)) {\n    throw new RpcProblem(-32602, \"params must be an object\");\n  }\n  const meta = msg.params._meta;\n  if (!isRecord(meta)) {\n    throw new RpcProblem(-32602, \"params._meta is required\");\n  }\n  const requested = meta[PROTOCOL_VERSION_KEY];\n  if (typeof requested !== \"string\") {\n    throw new RpcProblem(-32602, `${PROTOCOL_VERSION_KEY} is required`);\n  }\n  if (!(SUPPORTED_VERSIONS as readonly string[]).includes(requested)) {\n    throw new RpcProblem(-32022, \"Unsupported protocol version\", {\n      supported: [...SUPPORTED_VERSIONS],\n      requested,\n    });\n  }\n  if (!isRecord(meta[CLIENT_CAPABILITIES_KEY])) {\n    throw new RpcProblem(-32602, `${CLIENT_CAPABILITIES_KEY} is required`);\n  }","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/13-mcp-server-with-registry/code/ts/src/protocol.ts#L101-L137","documentation":"Error \"params must be an object\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/13-mcp-server-with-registry/code/ts/src/protocol.ts:119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}