Skip to main content
Glama
martechery

Google Ads MCP Server

by martechery

get_credential_status

Check authentication status for Google Ads API sessions in multi-tenant environments to verify credential validity before executing operations.

Instructions

Get credential status for a session (multi-tenant mode).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_keyYesUUID v4 session key

Implementation Reference

  • The tool handler for 'get_credential_status'. Registers the tool via addTool, validates multi-tenant mode and session key, retrieves credential status using getCredentialStatus helper, formats response as JSON text content, and logs the event.
    addTool(
      server,
      'get_credential_status',
      'Get credential status for a session (multi-tenant mode).',
      GetCredentialStatusZ,
      async (input: any) => {
        const startTs = Date.now();
        if (process.env.ENABLE_RUNTIME_CREDENTIALS !== 'true') {
          const out = { content: [{ type: 'text', text: 'Multi-tenant mode not enabled' }] };
          logEvent('get_credential_status', startTs, { requestId: input?.request_id, error: { code: 'ERR_NOT_ENABLED', message: 'Multi-tenant mode not enabled' } });
          return out;
        }
        try {
          validateSessionKey(String(input?.session_key || ''));
        } catch (e: any) {
          const msg = e?.message || String(e);
          logEvent('get_credential_status', startTs, { sessionKey: input?.session_key, requestId: input?.request_id, error: { code: 'ERR_INPUT', message: String(msg) } });
          return { content: [{ type: 'text', text: `Error: ${msg}` }] };
        }
        const status = getCredentialStatus(String(input.session_key));
        const out = { content: [{ type: 'text', text: JSON.stringify(status) }] };
        logEvent('get_credential_status', startTs, { sessionKey: input?.session_key, requestId: input?.request_id });
        return out;
      }
    );
  • Zod input schema for the get_credential_status tool, validating the required session_key parameter.
    export const GetCredentialStatusZ = z.object({
      session_key: z.string().describe('UUID v4 session key'),
    });
  • Helper function that checks the connection context for a session key and returns the credential status including presence, expiration time, refresh token availability, and a masked access token.
    export function getCredentialStatus(sessionKey: string): { has_credentials: boolean; expires_in: number; has_refresh_token: boolean; masked_token: string } {
      const ttlSec = parseInt(process.env.RUNTIME_CREDENTIAL_TTL || '3600', 10);
      const ctx = connections.get(sessionKey);
      if (!ctx) return { has_credentials: false, expires_in: 0, has_refresh_token: false, masked_token: '' };
      const token = ctx.credentials.access_token || '';
      const masked = token.length > 8 ? `${token.slice(0, 4)}****${token.slice(-4)}` : '****';
      return {
        has_credentials: true,
        expires_in: ttlSec,
        has_refresh_token: !!ctx.credentials.refresh_token,
        masked_token: masked,
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves status but doesn't specify what information is returned, whether it's read-only, if it requires authentication, or any rate limits. The mention of 'multi-tenant mode' is unclear and adds minimal context.

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, efficient sentence with no wasted words. It is front-loaded with the core purpose. However, the phrase 'multi-tenant mode' is ambiguous and could be considered unnecessary without further explanation, slightly reducing clarity.

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?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'credential status' includes, the format of the response, or any error conditions. Given the complexity implied by 'multi-tenant mode' and the lack of structured data, more detail is needed to make this tool usable.

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% description coverage, with the single parameter 'session_key' documented as a 'UUID v4 session key'. The description adds no additional meaning beyond this, such as where to obtain the session key or how it relates to credential status. Baseline 3 is appropriate given the schema does the heavy lifting.

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 states the tool's purpose as 'Get credential status for a session' which is clear but lacks specificity about what 'credential status' entails. It distinguishes from siblings by mentioning 'multi-tenant mode', but this is vague and doesn't clearly differentiate from tools like 'manage_auth' or 'set_session_credentials'.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'multi-tenant mode' but doesn't explain what this means or when it applies. There are no explicit instructions on prerequisites, timing, or comparisons with sibling tools like 'manage_auth' or 'refresh_access_token'.

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/martechery/mcp-google-ads-ts'

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