Skip to main content
Glama
wonyoungseong

GA4 MCP Server

ga4_property_details

Retrieve comprehensive configuration details for a Google Analytics 4 property, including name, time zone, currency, and industry settings, to understand and manage property setup.

Instructions

Returns details about a specific GA4 property including its name, display name, time zone, currency, industry category, and other settings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
propertyIdYesThe Google Analytics property ID. Accepted formats: '123456789', '123456789', or 'properties/123456789'

Implementation Reference

  • The getPropertyDetails function that implements the ga4_property_details tool. It gets the Analytics Admin client, constructs the property resource name, and calls the GA4 Admin API to retrieve property details.
    /**
     * Returns details about a specific GA4 property.
     */
    export async function getPropertyDetails(propertyId: string): Promise<ToolResponse> {
      try {
        const client = await getAnalyticsAdminClient();
        const propertyName = constructPropertyResourceName(propertyId);
    
        const response = await client.properties.get({
          name: propertyName,
        });
    
        return createSuccessResponse(response.data);
      } catch (error) {
        return createErrorResponse(`Failed to get property details for ${propertyId}`, error);
      }
    }
  • Tool registration schema definition for ga4_property_details, including name, description, and input schema with propertyId parameter.
    {
      name: "ga4_property_details",
      description: "Returns details about a specific GA4 property including its name, display name, time zone, currency, industry category, and other settings.",
      inputSchema: {
        type: "object" as const,
        properties: {
          propertyId: {
            type: "string",
            description: "The Google Analytics property ID. Accepted formats: '123456789', '123456789', or 'properties/123456789'",
          },
        },
        required: ["propertyId"],
      },
    },
  • Tool routing case that maps the ga4_property_details tool name to the getPropertyDetails handler function.
    case "ga4_property_details":
      return await getPropertyDetails(args.propertyId as string);
  • Helper function that constructs a properly formatted property resource name from various input formats (numeric, string, or properties/ prefix) for use with GA4 API calls.
    /**
     * Constructs a property resource name in the format required by GA4 APIs.
     * Accepts formats: "123456789", 123456789, or "properties/123456789"
     * Returns: "properties/123456789"
     */
    export function constructPropertyResourceName(propertyId: string | number): string {
      let propertyNum: number | null = null;
    
      if (typeof propertyId === "number") {
        propertyNum = propertyId;
      } else if (typeof propertyId === "string") {
        const trimmed = propertyId.trim();
        if (/^\d+$/.test(trimmed)) {
          propertyNum = parseInt(trimmed, 10);
        } else if (trimmed.startsWith("properties/")) {
          const numericPart = trimmed.split("/")[1];
          if (numericPart && /^\d+$/.test(numericPart)) {
            propertyNum = parseInt(numericPart, 10);
          }
        }
      }
    
      if (propertyNum === null) {
        throw new Error(
          `Invalid property ID: ${propertyId}. ` +
          "A valid property value is either a number or a string starting " +
          "with 'properties/' and followed by a number."
        );
      }
    
      return `properties/${propertyNum}`;
    }
  • ToolResponse interface type definition that defines the standard response format for all MCP tools, including ga4_property_details.
    // Tool response type for MCP
    export interface ToolResponse {
      content: Array<{
        type: "text";
        text: string;
      }>;
      isError?: boolean;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is a read operation ('Returns'), but doesn't disclose behavioral traits like authentication requirements, rate limits, error handling, or response format. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves beyond basic functionality.

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, well-structured sentence that efficiently lists key returned attributes. It's front-loaded with the core purpose and avoids unnecessary details, making every word earn its place without waste.

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

Completeness3/5

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

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description adequately covers the basic purpose. However, it lacks context on behavioral aspects (e.g., auth, errors) and doesn't leverage sibling tools for guidance, making it minimally complete but with clear room for improvement.

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, fully documenting the single parameter 'propertyId' with format details. The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without compensating value.

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 clearly states the verb ('Returns') and resource ('details about a specific GA4 property'), listing specific attributes like name, display name, time zone, etc. It distinguishes from siblings by focusing on property metadata rather than reports, summaries, or other operations. However, it doesn't explicitly differentiate from 'ga4_account_summaries' which might also include property details.

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 like 'ga4_account_summaries' (which might include property summaries) or 'ga4_run_report' (for data retrieval). It lacks explicit when/when-not instructions or named alternatives, leaving usage context implied at best.

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/wonyoungseong/ga4-mcp-server'

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