list_prompt_labels
List labels from a workspace or organization with optional search and scope filters, returning IDs, names, colors, status, and timestamps to select a label_id for other prompt operations.
Instructions
List labels across the workspace or organisation, with optional search and scope filters. Returns ids, names, colors, status, and timestamps so you can choose a label_id before get_prompt_label or update_prompt_version.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organisation_id | No | Filter by organisation ID | |
| workspace_id | No | Filter by workspace ID | |
| search | No | Search labels by name | |
| current_page | No | Page number for pagination | |
| page_size | No | Results per page (max 100) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the tool call succeeded and returned structured data | |
| data | No | Structured success payload when ok is true | |
| error | No | Structured error payload when ok is false |
Implementation Reference
- src/tools/labels.tools.ts:113-145 (registration)Registration of the 'list_prompt_labels' tool via server.tool() with its description, schema, and handler callback
// List labels tool server.tool( "list_prompt_labels", "List labels across the workspace or organisation, with optional search and scope filters. Returns ids, names, colors, status, and timestamps so you can choose a label_id before get_prompt_label or update_prompt_version.", LABELS_TOOL_SCHEMAS.listPromptLabels, async (params) => { const result = await service.labels.listLabels(params); return { content: [ { type: "text", text: JSON.stringify( { total: result.total, labels: result.data.map((label) => ({ id: label.id, name: label.name, description: label.description, color_code: label.color_code, is_universal: label.is_universal, status: label.status, created_at: label.created_at, last_updated_at: label.last_updated_at, })), }, null, 2, ), }, ], }; }, ); - src/tools/labels.tools.ts:118-144 (handler)Handler function that calls service.labels.listLabels(params) and returns formatted label data (id, name, description, color_code, is_universal, status, created_at, last_updated_at) with total count
async (params) => { const result = await service.labels.listLabels(params); return { content: [ { type: "text", text: JSON.stringify( { total: result.total, labels: result.data.map((label) => ({ id: label.id, name: label.name, description: label.description, color_code: label.color_code, is_universal: label.is_universal, status: label.status, created_at: label.created_at, last_updated_at: label.last_updated_at, })), }, null, 2, ), }, ], }; }, - src/tools/labels.tools.ts:25-43 (schema)Input schema for list_prompt_labels: optional organisation_id, workspace_id, search, current_page, and page_size (max 100) filters
listPromptLabels: { organisation_id: z .string() .optional() .describe("Filter by organisation ID"), workspace_id: z.string().optional().describe("Filter by workspace ID"), search: z.string().optional().describe("Search labels by name"), current_page: z.coerce .number() .positive() .optional() .describe("Page number for pagination"), page_size: z.coerce .number() .positive() .max(100) .optional() .describe("Results per page (max 100)"), }, - src/services/labels.service.ts:67-75 (helper)LabelsService.listLabels() method that makes a GET request to /labels endpoint with optional query params
async listLabels(params?: ListLabelsParams): Promise<ListLabelsResponse> { return this.get<ListLabelsResponse>("/labels", { organisation_id: params?.organisation_id, workspace_id: params?.workspace_id, search: params?.search, current_page: params?.current_page, page_size: params?.page_size, }); }