Skip to main content
Glama

get_language

Retrieve the language settings configured for your Gmail account to ensure proper display and localization of the interface.

Instructions

Gets language settings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_language' tool, registered via server.tool. It uses the shared handleTool to authenticate and call Gmail API's users.settings.getLanguage, then formats the response.
    server.tool("get_language",
      "Gets language settings",
      {},
      async () => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.settings.getLanguage({ userId: 'me' })
          return formatResponse(data)
        })
      }
    )
  • src/index.ts:853-862 (registration)
    Registration of the 'get_language' tool on the MCP server, including inline schema (empty input) and handler.
    server.tool("get_language",
      "Gets language settings",
      {},
      async () => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.settings.getLanguage({ userId: 'me' })
          return formatResponse(data)
        })
      }
    )
  • Input schema for 'get_language' tool: no parameters required.
    {},
  • Shared helper function handleTool used by get_language (and other tools) to handle OAuth authentication, create Gmail client, execute the API call, and handle errors.
    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}` });
      }
    }
  • Shared helper formatResponse used to wrap API responses in MCP content format.
    const formatResponse = (response: any) => ({ content: [{ type: "text", text: JSON.stringify(response) }] })
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a read operation ('gets'), but doesn't specify if it requires authentication, returns structured data, has side effects, or handles errors. This leaves significant gaps for a tool that likely interacts with user or system settings.

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?

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core purpose, making it easy to scan and understand quickly, which is ideal for a simple tool.

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 tool's likely complexity (accessing settings) and lack of annotations or output schema, the description is incomplete. It doesn't explain what 'language settings' includes, the return format, or any behavioral nuances, leaving the agent with insufficient context to use it effectively.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description doesn't add param info, but that's acceptable here—it avoids redundancy. A baseline of 4 is appropriate as it doesn't mislead or omit required details.

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

Purpose3/5

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

The description 'Gets language settings' clearly states the action (gets) and resource (language settings), but it's somewhat vague about what 'language settings' entails (e.g., user preferences, system defaults, or locale configurations). It distinguishes from siblings like 'update_language' by implying a read-only operation, but lacks specificity on scope or content.

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 explicit guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, context, or comparisons to other tools (e.g., 'update_language' for modifications), leaving usage decisions to inference based on the name alone.

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/faithk7/gmail-mcp'

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