get_label
Retrieve a specific Gmail label by providing its ID. Access label details to organize your email workflows.
Instructions
Get a specific label by ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the label to retrieve |
Implementation Reference
- src/index.ts:468-479 (registration)The tool 'get_label' is registered with the MCP server using server.tool(). It takes an 'id' parameter (string) describing the label ID to retrieve.
server.tool("get_label", "Get a specific label by ID", { id: z.string().describe("The ID of the label to retrieve") }, async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.labels.get({ userId: 'me', id: params.id }) return formatResponse(data) }) } ) - src/index.ts:473-478 (handler)The handler function for 'get_label' receives the Gmail client, calls gmail.users.labels.get() with the provided id, and returns the label data formatted as a JSON response.
async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.labels.get({ userId: 'me', id: params.id }) return formatResponse(data) }) } - src/index.ts:470-472 (schema)The input schema for 'get_label' defines a single required parameter 'id' of type string, describing the ID of the label to retrieve.
{ id: z.string().describe("The ID of the label to retrieve") },