List comments
listCommentsList comments attached to traces, observations, sessions, or prompts. Filter by object type, object ID, or author user ID, and paginate results.
Instructions
List comments attached to traces, observations, sessions, or prompts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (default 1) | |
| limit | No | Items per page (default 50, max 100) | |
| objectType | No | Filter by attached object type | |
| objectId | No | ||
| authorUserId | No |
Implementation Reference
- src/tools.ts:340-356 (handler)The handler function that executes the 'listComments' tool logic. It registers the tool with name 'listComments', defines the input schema (with optional objectType, objectId, authorUserId filters plus pagination), and the handler calls GET /api/public/comments with the provided args.
server.registerTool( "listComments", { title: "List comments", description: "List comments attached to traces, observations, sessions, or prompts.", inputSchema: { ...paginationShape, objectType: z .enum(["TRACE", "OBSERVATION", "SESSION", "PROMPT"]) .optional() .describe("Filter by attached object type"), objectId: z.string().optional(), authorUserId: z.string().optional(), }, }, async (args) => asJson(await client.get("/api/public/comments", args)), ); - src/tools.ts:340-356 (schema)The input schema for the 'listComments' tool, defined inline in the registerTool call. It uses spread paginationShape from schemas.ts and optional Zod fields: objectType (enum TRACE/OBSERVATION/SESSION/PROMPT), objectId (string), and authorUserId (string).
server.registerTool( "listComments", { title: "List comments", description: "List comments attached to traces, observations, sessions, or prompts.", inputSchema: { ...paginationShape, objectType: z .enum(["TRACE", "OBSERVATION", "SESSION", "PROMPT"]) .optional() .describe("Filter by attached object type"), objectId: z.string().optional(), authorUserId: z.string().optional(), }, }, async (args) => asJson(await client.get("/api/public/comments", args)), ); - src/tools.ts:392-420 (registration)The TOOL_NAMES array that exports the name 'listComments' as one of the registered tool names, used for external reference/type safety.
export const TOOL_NAMES = [ "listTraces", "getTrace", "listObservations", "getObservation", "listSessions", "getSession", "listScores", "getScore", "listScoreConfigs", "getScoreConfig", "listPrompts", "getPrompt", "listDatasets", "getDataset", "listDatasetItems", "getDatasetItem", "listDatasetRuns", "getDatasetRun", "getMetrics", "getDailyMetrics", "listModels", "getModel", "listProjects", "listComments", "getComment", "getMedia", "getHealth", ] as const; - src/schemas.ts:3-12 (helper)The paginationShape helper schema used by the 'listComments' tool, providing optional page (positive int) and limit (1-100 int) fields with descriptions.
export const paginationShape = { page: z.number().int().positive().optional().describe("Page number (default 1)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Items per page (default 50, max 100)"), };