hey_remove_label
Remove a label from an email thread. Idempotent — no error if the label is not currently applied. Use hey_list_labels to discover label IDs.
Instructions
Remove a label from an email thread. Idempotent — no error if the label is not currently applied. Returns {success, error?}. Use hey_list_labels to discover available label IDs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic_id | Yes | The topic/thread ID to unlabel | |
| label_id | Yes | The label ID to remove |
Implementation Reference
- src/index.ts:439-457 (registration)Tool schema registration for 'hey_remove_label' — defines name, description, and inputSchema with topic_id and label_id required parameters.
{ name: "hey_remove_label", description: "Remove a label from an email thread. Idempotent — no error if the label is not currently applied. Returns {success, error?}. Use hey_list_labels to discover available label IDs.", inputSchema: { type: "object" as const, properties: { topic_id: { type: "string", description: "The topic/thread ID to unlabel", }, label_id: { type: "string", description: "The label ID to remove", }, }, required: ["topic_id", "label_id"], }, }, - src/index.ts:1168-1195 (handler)Handler case in the switch statement for 'hey_remove_label' — validates topic_id and label_id, then calls the removeLabel function.
case "hey_remove_label": { const topicId = validateId(args?.topic_id) const labelId = validateId(args?.label_id) if (!topicId) { return { content: [ { type: "text", text: "Error: topic_id is required and must be valid", }, ], isError: true, } } if (!labelId) { return { content: [ { type: "text", text: "Error: label_id is required and must be valid", }, ], isError: true, } } result = await removeLabel(topicId, labelId) break } - src/tools/organise.ts:689-711 (handler)The removeLabel function implementation — sends a DELETE request to /topics/{topicId}/filings?folder_id={labelId} to remove a label from an email thread.
export async function removeLabel( topicId: string, labelId: string, ): Promise<OrganiseResult> { if (!topicId) { return { success: false, error: "Topic ID is required" } } if (!labelId) { return { success: false, error: "Label ID is required" } } try { const response = await withCsrfRetry(() => heyClient.delete(`/topics/${topicId}/filings?folder_id=${labelId}`), ) return organiseResponseToResult(response, () => invalidateForAction("label", topicId), ) } catch (err) { return { success: false, error: toUserError(err) } } } - src/index.ts:36-37 (registration)Import of the removeLabel function from src/tools/organise.ts into the main server.
removeLabel, replyLater,