🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(mcp): migrate score read tools from scores v2 to v3 (LFE-11051) (#15219)
Niklas Semmler8af3ec465bfd
diff --git a/web/src/__tests__/server/mcp-tools-read.servertest.ts b/web/src/__tests__/server/mcp-tools-read.servertest.tsindex 680d3c5983..f4e78cdb4d 100644--- a/web/src/__tests__/server/mcp-tools-read.servertest.ts+++ b/web/src/__tests__/server/mcp-tools-read.servertest.ts@@ -38,9 +38,11 @@ import { createHash, randomUUID } from "crypto";import { z } from "zod";import { prisma } from "@langfuse/shared/src/db";import {+ createDatasetRunScore,createEvent,createEventsCh,createScoresCh,+ createSessionScore,createTraceScore,} from "@langfuse/shared/src/server";import { ScoreConfigDataType } from "@langfuse/shared";@@ -61,8 +63,10 @@ import {buildDashboardWidgetUrl,buildEvaluatorUrl,buildMonitorUrl,+ buildExperimentUrl,buildObservationUrl,buildPromptUrl,+ buildSessionUrl,buildTraceUrl,} from "@/src/utils/product-url";import { handleCreateDashboardWidget } from "@/src/features/mcp/features/dashboardWidgets/tools/createDashboardWidget";@@ -2221,16 +2225,16 @@ describe("MCP Read Tools", () => {verifyToolAnnotations(listScoresTool, { readOnlyHint: true });});- it("should return paginated scores with object-shaped filters", async () => {+ it("should return v3-shaped scores with polymorphic value, subject, and url", async () => {const { context, projectId } = await createMcpTestSetup();- const matchingScore = createTraceScore({+ const numericScore = createTraceScore({project_id: projectId,id: randomUUID(),name: `mcp-score-${nanoid()}`,data_type: "NUMERIC",value: 0.9,});- const otherScore = createTraceScore({+ const booleanScore = createTraceScore({project_id: projectId,id: randomUUID(),name: `mcp-score-${nanoid()}`,@@ -2238,63 +2242,204 @@ describe("MCP Read Tools", () => {value: 1,string_value: "True",});+ const sessionScore = createSessionScore({+ project_id: projectId,+ id: randomUUID(),+ name: `mcp-score-${nanoid()}`,+ data_type: "CATEGORICAL",+ value: 0,+ string_value: "good",+ });- await createScoresCh([matchingScore, otherScore]);+ await createScoresCh([numericScore, booleanScore, sessionScore]);const result = (await handleListScores({limit: 10,- page: 1,- scoreIds: [matchingScore.id, otherScore.id],- dataType: "NUMERIC",- fields: ["score"],+ scoreIds: [numericScore.id, booleanScore.id, sessionScore.id],+ dataType: ["NUMERIC"],},context,)) as any;- const data = result.data;expect(Object.keys(result).sort()).toEqual(["data", "meta"]);- expect(result.meta).toMatchObject({- page: 1,- limit: 10,- totalItems: 1,- });- expect(data).toHaveLength(1);- expect(data).toEqual([+ expect(result.meta).toEqual({ limit: 10 });+ expect(result.data).toEqual([expect.objectContaining({- id: matchingScore.id,+ id: numericScore.id,dataType: "NUMERIC",+ value: 0.9,+ comment: numericScore.comment,+ subject: { kind: "trace", id: numericScore.trace_id },url: buildTraceUrl({projectId,- traceId: matchingScore.trace_id!,+ traceId: numericScore.trace_id!,+ }),+ }),+ ]);++ const booleanResult = (await handleListScores(+ { limit: 10, scoreIds: [booleanScore.id] },+ context,+ )) as any;+ expect(booleanResult.data).toEqual([+ expect.objectContaining({+ id: booleanScore.id,+ dataType: "BOOLEAN",+ value: true,+ }),+ ]);++ const sessionResult = (await handleListScores(+ { limit: 10, scoreIds: [sessionScore.id] },+ context,+ )) as any;+ expect(sessionResult.data).toEqual([+ expect.objectContaining({+ id: sessionScore.id,+ dataType: "CATEGORICAL",+ value: "good",+ subject: { kind: "session", id: sessionScore.session_id },+ url: buildSessionUrl({+ projectId,+ sessionId: sessionScore.session_id!,}),}),]);- expect(data).toEqual([- expect.not.objectContaining({ trace: expect.anything() }),+ });++ it("should link experiment-subject scores to the experiment results page", async () => {+ const { context, projectId } = await createMcpTestSetup();+ const runScore = createDatasetRunScore({+ project_id: projectId,+ id: randomUUID(),+ name: `mcp-run-score-${nanoid()}`,+ data_type: "NUMERIC",+ value: 0.7,+ });++ await createScoresCh([runScore]);++ const result = (await handleListScores(+ { limit: 10, scoreIds: [runScore.id] },+ context,+ )) as any;+ expect(result.data).toEqual([+ expect.objectContaining({+ id: runScore.id,+ subject: { kind: "experiment", id: runScore.dataset_run_id },+ url: buildExperimentUrl({+ projectId,+ experimentId: runScore.dataset_run_id!,+ }),+ }),]);});- it("should enforce public v2 score field validation", async () => {+ it("should paginate with an opaque cursor", async () => {+ const { context, projectId } = await createMcpTestSetup();+ const name = `mcp-cursor-score-${nanoid()}`;+ const now = Date.now();+ const scores = [0, 1, 2].map((i) =>+ createTraceScore({+ project_id: projectId,+ id: randomUUID(),+ name,+ data_type: "NUMERIC",+ value: i,+ timestamp: now - i * 60_000,+ }),+ );++ await createScoresCh(scores);++ const firstPage = (await handleListScores(+ { limit: 2, name: [name] },+ context,+ )) as any;+ expect(firstPage.data).toHaveLength(2);+ expect(firstPage.meta.limit).toBe(2);+ expect(firstPage.meta.cursor).toEqual(expect.any(String));++ const secondPage = (await handleListScores(+ { limit: 2, name: [name], cursor: firstPage.meta.cursor },+ context,+ )) as any;+ expect(secondPage.data).toHaveLength(1);+ expect(secondPage.meta.cursor).toBeUndefined();++ const seenIds = [...firstPage.data, ...secondPage.data].map(+ (score: { id: string }) => score.id,+ );+ expect(seenIds.sort()).toEqual(scores.map((s) => s.id).sort());++ await expect(+ handleListScores(+ { limit: 2, name: [name], cursor: "not-base64-json" },+ context,+ ),+ ).rejects.toThrow(/invalid cursor format/i);++ // Decodable JSON with a mismatched cursor schema (e.g. future version)+ // must surface the same error, not a raw schema failure.+ const wrongVersionCursor = Buffer.from(+ JSON.stringify({ v: 2, lastId: "x" }),+ ).toString("base64url");+ await expect(+ handleListScores(+ { limit: 2, name: [name], cursor: wrongVersionCursor },+ context,+ ),+ ).rejects.toThrow(/invalid cursor format/i);+ });++ it("should enforce v3 cross-field validation and reject dropped v2 params", async () => {const { context } = await createMcpTestSetup();await expect(- handleListScores({ fields: ["trace"], limit: 10, page: 1 }, context),- ).rejects.toThrow(/Scores needs to be selected always/i);+ handleListScores({ limit: 10, value: ["0.5"] }, context),+ ).rejects.toThrow(/value filter requires a single dataType/i);+ // Number("") === 0: an empty placeholder must not become a value=0 filter.await expect(handleListScores(- { fields: ["score"], userId: "user-1", limit: 10, page: 1 },+ { limit: 10, value: [""], dataType: ["NUMERIC"] },context,),- ).rejects.toThrow(/Cannot filter by trace properties/i);+ ).rejects.toThrow(/value filter entries must be non-empty/i);+ await expect(+ handleListScores(+ { limit: 10, value: [" "], dataType: ["NUMERIC"] },+ context,+ ),+ ).rejects.toThrow(/value filter entries must be non-empty/i);++ await expect(+ handleListScores({ limit: 10, valueMin: 0.5 }, context),+ ).rejects.toThrow(/valueMin and valueMax require dataType=NUMERIC/i);++ await expect(+ handleListScores({ limit: 10, observationId: [randomUUID()] }, context),+ ).rejects.toThrow(/observationId filter requires traceId/i);await expect(handleListScores(- { fields: ["score"], traceTags: [], limit: 10, page: 1 },+ { limit: 10, traceId: [randomUUID()], sessionId: [randomUUID()] },context,),- ).resolves.toMatchObject({ data: [] });+ ).rejects.toThrow(/At most one of traceId, sessionId, experimentId/i);++ // v2-only params (userId, traceTags, page, fields, filter) are rejected+ // by the strict schema instead of being silently ignored.+ await expect(+ handleListScores({ limit: 10, userId: "user-1" } as any, context),+ ).rejects.toThrow(/validation failed/i);+ await expect(+ handleListScores({ limit: 10, traceTags: ["tag"] } as any, context),+ ).rejects.toThrow(/validation failed/i);+ await expect(+ handleListScores({ limit: 10, page: 1 } as any, context),+ ).rejects.toThrow(/validation failed/i);});});@@ -2322,6 +2467,8 @@ describe("MCP Read Tools", () => {name: score.name,dataType: "NUMERIC",value: 0.8,+ comment: score.comment,+ subject: { kind: "trace", id: score.trace_id },url: buildTraceUrl({ projectId, traceId: score.trace_id! }),});});diff --git a/web/src/features/mcp/features/scores/tools/getScore.ts b/web/src/features/mcp/features/scores/tools/getScore.tsindex b7f68567f0..b0ccee099d 100644--- a/web/src/features/mcp/features/scores/tools/getScore.ts+++ b/web/src/features/mcp/features/scores/tools/getScore.ts@@ -1,55 +1,42 @@-import {- GetScoreQueryV2,- GetScoreResponseV2,- InternalServerError,- LangfuseNotFoundError,-} from "@langfuse/shared";-import { logger, traceException } from "@langfuse/shared/src/server";+import { LangfuseNotFoundError, SCORE_FIELD_GROUPS_V3 } from "@langfuse/shared";+import { z } from "zod";import { defineTool } from "../../../core/define-tool";-import { buildScoreTargetUrl } from "@/src/utils/product-url";import { runMcpTool } from "../../../core/run-mcp-tool";-import { ScoresApiService } from "@/src/features/public-api/server/scores-api-service";+import { listScoresV3ForPublicApi } from "@/src/features/public-api/server/scores-api-v3";+import { buildScoreSubjectUrl } from "@/src/utils/product-url";++const GetScoreInputSchema = z.object({ scoreId: z.string() }).strict();export const [getScoreTool, handleGetScore] = defineTool({name: "getScore",description: ["Fetch one score by ID from the current Langfuse project.",+ "The score carries a polymorphic value matching its dataType (number, boolean, or string) and a subject describing what it scores: { kind: trace | observation | session | experiment, id }.","Score reads are eventually consistent: a score created with createScore may not be returned by getScore immediately. If a newly created score is not found, wait briefly and retry.",].join("\n"),- baseSchema: GetScoreQueryV2,- inputSchema: GetScoreQueryV2,+ baseSchema: GetScoreInputSchema,+ inputSchema: GetScoreInputSchema,handler: async (input, context) => {return await runMcpTool({spanName: "mcp.scores.get",context,attributes: { "mcp.score_id": input.scoreId },fn: async () => {- const scoresApiService = new ScoresApiService("v2");- const score = await scoresApiService.getScoreById({+ // v3 has no by-id route; a v3 list with an id filter is the lookup path.+ const result = await listScoresV3ForPublicApi({projectId: context.projectId,- scoreId: input.scoreId,+ limit: 1,+ fields: [...SCORE_FIELD_GROUPS_V3],+ id: [input.scoreId],});+ const score = result.data[0];if (!score) {throw new LangfuseNotFoundError("Score not found");}- const parsedScore = GetScoreResponseV2.safeParse(score);- if (!parsedScore.success) {- traceException(parsedScore.error);- logger.error(`Incorrect score return type ${parsedScore.error}`);- throw new InternalServerError("Requested score is corrupted");- }-- const { traceId, observationId, sessionId } = parsedScore.data;- const url = buildScoreTargetUrl({- projectId: context.projectId,- traceId,- observationId,- sessionId,- });-- return url ? { ...parsedScore.data, url } : parsedScore.data;+ const url = buildScoreSubjectUrl(context.projectId, score.subject);+ return url ? { ...score, url } : score;},});},diff --git a/web/src/features/mcp/features/scores/tools/listScores.ts b/web/src/features/mcp/features/scores/tools/listScores.tsindex 6923467a2c..f334074d1a 100644--- a/web/src/features/mcp/features/scores/tools/listScores.ts+++ b/web/src/features/mcp/features/scores/tools/listScores.ts@@ -1,90 +1,152 @@import {- filterAndValidateV2GetScoreList,InvalidRequestError,+ SCORE_FIELD_GROUPS_V3,ScoreDataTypeDomain,ScoreSourceDomain,- singleFilter,- publicApiPaginationZod,} from "@langfuse/shared";import { z } from "zod";import { defineTool } from "../../../core/define-tool";-import { McpAdvancedFilterBaseSchema } from "../../../core/filter-schema";-import { buildScoreTargetUrl } from "@/src/utils/product-url";import { runMcpTool } from "../../../core/run-mcp-tool";-import { ScoresApiService } from "@/src/features/public-api/server/scores-api-service";-import { paginationMeta } from "../../publicApi";+import { listScoresV3ForPublicApi } from "@/src/features/public-api/server/scores-api-v3";+import { EncodedScoresCursorV3 } from "@/src/features/public-api/types/scores";+import { buildScoreSubjectUrl } from "@/src/utils/product-url";-const ScoreFieldsSchema = z- .array(z.enum(["score", "trace"]))- .default(["score", "trace"])- .describe(- "Response field groups to include. 'score' is always required. Include 'trace' when filtering by userId or traceTags.",- );+const ListScoresBaseSchema = z+ .object({+ limit: z.number().int().gte(1).lte(100).default(50),+ cursor: z.string().optional(),+ scoreIds: z.array(z.string()).optional(),+ name: z.array(z.string()).optional(),+ source: z.array(ScoreSourceDomain).optional(),+ dataType: z.array(ScoreDataTypeDomain).optional(),+ environment: z.array(z.string()).optional(),+ configId: z.array(z.string()).optional(),+ queueId: z.array(z.string()).optional(),+ authorUserId: z.array(z.string()).optional(),+ value: z+ .array(z.coerce.string())+ .optional()+ .describe(+ "string-encoded, requires a single dataType (NUMERIC, BOOLEAN, or CATEGORICAL)",+ ),+ valueMin: z+ .number()+ .optional()+ .describe('inclusive, requires dataType: ["NUMERIC"]'),+ valueMax: z+ .number()+ .optional()+ .describe('inclusive, requires dataType: ["NUMERIC"]'),+ traceId: z.array(z.string()).optional(),+ sessionId: z.array(z.string()).optional(),+ observationId: z.array(z.string()).optional().describe("requires traceId"),+ experimentId: z+ .array(z.string())+ .optional()+ .describe("same ID as datasetRunId in createScore"),+ fromTimestamp: z.iso.datetime({ offset: true }).optional(),+ toTimestamp: z.iso.datetime({ offset: true }).optional(),+ })+ .strict();-const ListScoresSharedSchemaFields = {- ...publicApiPaginationZod,- fields: ScoreFieldsSchema,- userId: z.string().optional(),- dataType: ScoreDataTypeDomain.optional(),- configId: z.string().optional(),- queueId: z.string().optional(),- traceTags: z.array(z.string()).optional(),- environment: z.array(z.string()).optional(),- name: z.string().optional(),- fromTimestamp: z.iso.datetime({ offset: true }).optional(),- toTimestamp: z.iso.datetime({ offset: true }).optional(),- source: ScoreSourceDomain.optional(),- value: z.number().optional(),- operator: z.enum(["<", ">", "<=", ">=", "!=", "="]).optional(),- scoreIds: z.array(z.string()).optional(),- sessionId: z.string().optional(),- traceId: z.string().optional(),- datasetRunId: z.string().optional(),- observationId: z.array(z.string()).optional(),+// EncodedScoresCursorV3 throws InvalidRequestError for undecodable base64/JSON+// but a ZodError for decodable JSON with a mismatched schema (e.g. a future+// cursor version); normalize both to the same client-facing error.+const parseCursor = (cursor: string) => {+ try {+ return EncodedScoresCursorV3.parse(cursor);+ } catch (_e) {+ throw new InvalidRequestError("Invalid cursor format");+ }};-const ListScoresBaseSchema = z.object({- ...ListScoresSharedSchemaFields,- filter: z- .array(McpAdvancedFilterBaseSchema)- .optional()- .describe(- "Advanced score filters as JSON objects with column, operator, value, and type.",- ),-});--const ListScoresInputSchema = z.object({- ...ListScoresSharedSchemaFields,- filter: z- .array(singleFilter)- .optional()- .describe(- "Advanced score filters as JSON objects with column, operator, value, and type.",- ),-});+const ListScoresInputSchema = ListScoresBaseSchema.superRefine((data, ctx) => {+ if (data.value !== undefined && data.value.length > 0) {+ // Number("") and Number(" ") coerce to 0, which would silently turn an+ // empty placeholder into a value=0 filter — reject instead.+ for (const v of data.value) {+ if (v.trim().length === 0) {+ ctx.addIssue({+ code: "custom",+ message: "value filter entries must be non-empty strings",+ });+ }+ }+ const dataType = data.dataType?.length === 1 ? data.dataType[0] : undefined;+ if (+ !dataType ||+ !["NUMERIC", "BOOLEAN", "CATEGORICAL"].includes(dataType)+ ) {+ ctx.addIssue({+ code: "custom",+ message:+ "value filter requires a single dataType from: NUMERIC, BOOLEAN, CATEGORICAL",+ });+ } else if (dataType === "NUMERIC") {+ for (const v of data.value) {+ if (!isFinite(Number(v))) {+ ctx.addIssue({+ code: "custom",+ message: `value filter with dataType=NUMERIC requires each value to be a finite number (got "${v}")`,+ });+ }+ }+ } else if (dataType === "BOOLEAN") {+ for (const v of data.value) {+ if (v !== "true" && v !== "false") {+ ctx.addIssue({+ code: "custom",+ message: `value filter with dataType=BOOLEAN requires each value to be "true" or "false" (got "${v}")`,+ });+ }+ }+ }+ }-type ListScoresInput = z.infer<typeof ListScoresInputSchema>;+ if (+ (data.valueMin !== undefined || data.valueMax !== undefined) &&+ !(data.dataType?.length === 1 && data.dataType[0] === "NUMERIC")+ ) {+ ctx.addIssue({+ code: "custom",+ message:+ "valueMin and valueMax require dataType=NUMERIC as a single value",+ });+ }-const assertValidScoreFields = (input: ListScoresInput) => {- if (!input.fields.includes("score")) {- throw new InvalidRequestError("Scores needs to be selected always.");+ if (+ (data.observationId?.length ?? 0) > 0 &&+ (data.traceId?.length ?? 0) === 0+ ) {+ ctx.addIssue({+ code: "custom",+ message:+ "observationId filter requires traceId — observation IDs are scoped to a trace",+ });}- const hasTraceFilters =- Boolean(input.userId) || (input.traceTags?.length ?? 0) > 0;- if (!input.fields.includes("trace") && hasTraceFilters) {- throw new InvalidRequestError(- "Cannot filter by trace properties (userId, traceTags) when 'trace' field is not included. Please add 'trace' to the fields parameter or remove trace filters.",- );+ const exclusiveEntityFilters = [+ data.traceId,+ data.sessionId,+ data.experimentId,+ ].filter((arr) => arr && arr.length > 0);+ if (exclusiveEntityFilters.length > 1) {+ ctx.addIssue({+ code: "custom",+ message:+ "At most one of traceId, sessionId, experimentId may be specified",+ });}-};+});export const [listScoresTool, handleListScores] = defineTool({name: "listScores",description: ["Find scores in Langfuse.",- "Use this to review quality, evaluation, or feedback scores for traces, observations, sessions, and dataset runs.",- "Filter by score details, time range, environment, source, trace information, or dataset run context to narrow the results.",+ "Use this to review quality, evaluation, or feedback scores for traces, observations, sessions, and experiments (dataset runs).",+ "Each score carries a polymorphic value matching its dataType (number, boolean, or string) and a subject describing what it scores: { kind: trace | observation | session | experiment, id }.",+ "Results are paginated with an opaque cursor: pass meta.cursor from the previous response to fetch the next page; a response without meta.cursor is the last page.",+ "Filtering by trace user or trace tags is not supported. To find scores for a specific user, first resolve the user's trace IDs (e.g. via listObservations with userId), then filter scores by traceId.","Score reads are eventually consistent: a score created with createScore may not appear in listScores immediately. If a newly created score is missing, wait briefly and retry.",].join("\n"),baseSchema: ListScoresBaseSchema,@@ -94,64 +156,50 @@ export const [listScoresTool, handleListScores] = defineTool({spanName: "mcp.scores.list",context,attributes: {- "mcp.pagination_page": input.page,"mcp.pagination_limit": input.limit,- "mcp.score_fields": input.fields.join(","),},fn: async (span) => {- assertValidScoreFields(input);-- const scoreParams = {+ const result = await listScoresV3ForPublicApi({projectId: context.projectId,- page: input.page,limit: input.limit,- userId: input.userId,+ cursor: input.cursor ? parseCursor(input.cursor) : undefined,+ // Always fetch every field group: subject feeds the url mapping below.+ fields: [...SCORE_FIELD_GROUPS_V3],+ id: input.scoreIds,name: input.name,- configId: input.configId,- sessionId: input.sessionId,- traceId: input.traceId,- observationId: input.observationId,- datasetRunId: input.datasetRunId,- queueId: input.queueId,- traceTags: input.traceTags,+ source: input.source,dataType: input.dataType,- fromTimestamp: input.fromTimestamp,- toTimestamp: input.toTimestamp,environment: input.environment,- source: input.source,+ configId: input.configId,+ queueId: input.queueId,+ authorUserId: input.authorUserId,value: input.value,- operator: input.operator,- scoreIds: input.scoreIds,- fields: input.fields,- advancedFilters: input.filter,- };-- const scoresApiService = new ScoresApiService("v2");- const [items, count] = await Promise.all([- scoresApiService.generateScoresForPublicApi(scoreParams),- scoresApiService.getScoresCountForPublicApi(scoreParams),- ]);-- const totalItems = count ?? 0;- const data = filterAndValidateV2GetScoreList(items).map((score) => {- const url = buildScoreTargetUrl({- projectId: context.projectId,- traceId: score.traceId,- observationId: score.observationId,- sessionId: score.sessionId,- });+ valueMin: input.valueMin,+ valueMax: input.valueMax,+ traceId: input.traceId,+ sessionId: input.sessionId,+ observationId: input.observationId,+ experimentId: input.experimentId,+ fromTimestamp: input.fromTimestamp+ ? new Date(input.fromTimestamp)+ : undefined,+ toTimestamp: input.toTimestamp+ ? new Date(input.toTimestamp)+ : undefined,+ });+ const data = result.data.map((score) => {+ const url = buildScoreSubjectUrl(context.projectId, score.subject);return url ? { ...score, url } : score;});span.setAttribute("mcp.result_count", data.length);return {data,- meta: paginationMeta({- page: input.page,+ meta: {limit: input.limit,- totalItems,- }),+ ...(result.cursor ? { cursor: result.cursor } : {}),+ },};},});diff --git a/web/src/utils/product-url.ts b/web/src/utils/product-url.tsindex 766750e52a..5a408391cb 100644--- a/web/src/utils/product-url.ts+++ b/web/src/utils/product-url.ts@@ -1,4 +1,4 @@-import type { FilterState } from "@langfuse/shared";+import type { APIScoreV3, FilterState } from "@langfuse/shared";import { encodeFiltersGeneric } from "@/src/features/filters/lib/filter-query-encoding";import { getProductBaseUrl } from "@/src/utils/base-url";import {@@ -409,6 +409,28 @@ export const buildScoreTargetUrl = (params: {return undefined;};+export const buildScoreSubjectUrl = (+ projectId: string,+ subject: APIScoreV3["subject"],+): string | undefined => {+ if (!subject) return undefined;++ switch (subject.kind) {+ case "trace":+ return buildScoreTargetUrl({ projectId, traceId: subject.id });+ case "observation":+ return buildScoreTargetUrl({+ projectId,+ traceId: subject.traceId,+ observationId: subject.id,+ });+ case "session":+ return buildScoreTargetUrl({ projectId, sessionId: subject.id });+ case "experiment":+ return buildExperimentUrl({ projectId, experimentId: subject.id });+ }+};+export const buildPromptUrl = (params: {projectId: string;name: string;