Skip to main content
Glama

update_language

Change the display language for your Gmail interface by specifying a valid language tag to customize your email management experience.

Instructions

Updates language settings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
displayLanguageYesThe language to display Gmail in, formatted as an RFC 3066 Language Tag

Implementation Reference

  • Handler function for the 'update_language' tool. It invokes the Gmail API's users.settings.updateLanguage method via the shared handleTool wrapper to update the display language.
    async (params) => {
      return handleTool(config, async (gmail: gmail_v1.Gmail) => {
        const { data } = await gmail.users.settings.updateLanguage({ userId: 'me', requestBody: params })
        return formatResponse(data)
      })
    }
  • Input schema using Zod for validating the 'displayLanguage' parameter of the update_language tool.
    {
      displayLanguage: z.string().describe("The language to display Gmail in, formatted as an RFC 3066 Language Tag")
    },
  • src/index.ts:916-927 (registration)
    Registration of the 'update_language' tool on the MCP server, including name, description, schema, and handler.
    server.tool("update_language",
      "Updates language settings",
      {
        displayLanguage: z.string().describe("The language to display Gmail in, formatted as an RFC 3066 Language Tag")
      },
      async (params) => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.settings.updateLanguage({ userId: 'me', requestBody: params })
          return formatResponse(data)
        })
      }
    )
  • Shared helper function used by all Gmail tools, including update_language, to handle OAuth2 authentication, client creation, error handling, and API call execution.
    const handleTool = async (queryConfig: Record<string, any> | undefined, apiCall: (gmail: gmail_v1.Gmail) => Promise<any>) => {
      try {
        const oauth2Client = queryConfig ? createOAuth2Client(queryConfig) : defaultOAuth2Client
        if (!oauth2Client) throw new Error('OAuth2 client could not be created, please check your credentials')
    
        const credentialsAreValid = await validateCredentials(oauth2Client)
        if (!credentialsAreValid) throw new Error('OAuth2 credentials are invalid, please re-authenticate')
    
        const gmailClient = queryConfig ? google.gmail({ version: 'v1', auth: oauth2Client }) : defaultGmailClient
        if (!gmailClient) throw new Error('Gmail client could not be created, please check your credentials')
    
        const result = await apiCall(gmailClient)
        return result
      } catch (error: any) {
        // Check for specific authentication errors
        if (
          error.message?.includes("invalid_grant") ||
          error.message?.includes("refresh_token") ||
          error.message?.includes("invalid_client") ||
          error.message?.includes("unauthorized_client") ||
          error.code === 401 ||
          error.code === 403
        ) {
          return formatResponse({
            error: `Authentication failed: ${error.message}. Please re-authenticate by running: npx @shinzolabs/gmail-mcp auth`,
          });
        }
    
        return formatResponse({ error: `Tool execution failed: ${error.message}` });
      }
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

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

Without annotations, the description must disclose behavioral traits. It only states 'updates' but does not mention whether the operation is reversible, requires authentication, or has side effects.

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

Conciseness4/5

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

The description is a single sentence that is front-loaded and concise. However, it could provide slightly more informative content without compromising brevity.

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

Completeness2/5

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

Given the simplicity of the tool with one parameter and no output schema, the description is complete in a minimal sense but lacks context about the update behavior, default values, or what the response looks like.

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?

The input schema has 100% coverage for the single parameter, including a description of the RFC 3066 Language Tag format. The tool description adds no additional meaning beyond the schema.

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

Purpose4/5

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

The description 'Updates language settings' clearly indicates the action (update) and resource (language settings). It distinguishes from sibling tools like 'get_language' (read) and other update tools for different settings.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives, such as 'get_language' for reading or other update tools. No prerequisites or context for use are mentioned.

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