Skip to main content
Glama

list_prompt_labels

Read-onlyIdempotent

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

TableJSON Schema
NameRequiredDescriptionDefault
organisation_idNoFilter by organisation ID
workspace_idNoFilter by workspace ID
searchNoSearch labels by name
current_pageNoPage number for pagination
page_sizeNoResults per page (max 100)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the tool call succeeded and returned structured data
dataNoStructured success payload when ok is true
errorNoStructured error payload when ok is false

Implementation Reference

  • 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,
    					),
    				},
    			],
    		};
    	},
    );
  • 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,
    				),
    			},
    		],
    	};
    },
  • 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)"),
    },
  • 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,
    	});
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Description adds that it returns specific fields but does not disclose pagination behavior or openWorldHint implications. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences: first states purpose and filters, second states output and use. No unnecessary words, fits front-loading expectation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has 5 optional parameters, an output schema, and pagination params. Description covers purpose, output fields, and typical use case. Lacks mention of pagination behavior (e.g., default page size), but is still adequate for most agents.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% coverage with descriptions for all 5 parameters. Description only mentions 'optional search and scope filters', adding no extra meaning beyond schema. Baseline 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists labels across workspace/organisation with optional filters, and specifies returned fields. It distinguishes itself from get_prompt_label and update_prompt_version by noting use case.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description says 'choose a label_id before get_prompt_label or update_prompt_version', guiding use. Does not explicitly state when not to use, but purpose and sibling context imply it's for listing, not for single label retrieval or modification.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/s-b-e-n-s-o-n/portkey-admin-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server