Skip to main content
Glama
davidmosiah

Google Health MCP

by davidmosiah

Get Google Health OAuth URL

google_health_get_auth_url
Read-onlyIdempotent

Generate a Google OAuth authorization URL to obtain user consent for accessing Google Health API data when no local token exists.

Instructions

Generate a Google OAuth authorization URL for Google Health API. Use this first when no local token exists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateNoOptional OAuth state value generated by the caller.
scopesNoOptional scope override. Defaults to read-only Google Health scopes used by this server.
response_formatNomarkdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
auth_urlYes
redirect_uriYes
scopesYes
next_stepYes

Implementation Reference

  • The tool handler registered as 'google_health_get_auth_url'. It calls GoogleHealthClient.authUrl() with optional state and scopes, then returns the OAuth URL, redirect URI, scopes, and next_step instructions.
    server.registerTool("google_health_get_auth_url", {
      title: "Get Google Health OAuth URL",
      description: "Generate a Google OAuth authorization URL for Google Health API. Use this first when no local token exists.",
      inputSchema: AuthUrlInputSchema.shape,
      outputSchema: AuthUrlOutputSchema.shape,
      annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }
    }, async (params) => {
      try {
        const config = getConfig();
        const url = new GoogleHealthClient(config).authUrl(params.state, params.scopes);
        const output = {
          auth_url: url,
          redirect_uri: config.redirectUri,
          scopes: params.scopes?.length ? params.scopes : config.scopes,
          next_step: "Open auth_url, approve access, then pass the returned code or full redirect URL to google_health_exchange_code."
        };
        return makeResponse(output, params.response_format, bulletList("Google Health OAuth URL", output));
      } catch (error) {
        return makeError((error as Error).message);
      }
    });
  • AuthUrlInputSchema defines the input: optional state (string max 500), optional scopes (array of strings), and response_format.
    export const AuthUrlInputSchema = z.object({
      state: z.string().max(500).optional().describe("Optional OAuth state value generated by the caller."),
      scopes: z.array(z.string()).optional().describe("Optional scope override. Defaults to read-only Google Health scopes used by this server."),
      response_format: ResponseFormatSchema
    }).strict();
  • AuthUrlOutputSchema defines the output: auth_url (string), redirect_uri (string), scopes (string array), and next_step (string).
    export const AuthUrlOutputSchema = z.object({
      auth_url: z.string(),
      redirect_uri: z.string(),
      scopes: z.array(z.string()),
      next_step: z.string()
    }).strict();
  • GoogleHealthClient.authUrl() builds the OAuth authorization URL using GOOGLE_HEALTH_AUTH_URL constant, config client_id/redirect_uri, optional state, and scopes.
    authUrl(state?: string, scopes?: string[]): string {
      const params = new URLSearchParams({
        client_id: this.config.clientId,
        redirect_uri: this.config.redirectUri,
        response_type: "code",
        scope: (scopes?.length ? scopes : this.config.scopes).join(" "),
        access_type: "offline",
        include_granted_scopes: "true",
        prompt: "consent"
      });
      if (state) params.set("state", state);
      return `${GOOGLE_HEALTH_AUTH_URL}?${params.toString()}`;
    }
  • The tool name is listed in STANDARD_TOOLS array used for agent manifest generation.
    "google_health_get_auth_url",
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true, providing strong behavioral transparency. The description adds minimal extra context beyond calling it 'Generate', which is consistent. No contradictions.

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 sentence, front-loaded with the key action and resource, with no extraneous text. Every word earns its place.

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

Completeness4/5

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

The tool is simple and the description, combined with annotations and output schema, provides sufficient context. However, it could mention that the URL is for manual user interaction or redirect. Nonetheless, it is largely complete.

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?

Schema description coverage is 67%, with two of three parameters described in the schema. The tool description does not add any additional parameter information beyond what is in the schema, so baseline score of 3 applies.

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

Purpose5/5

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

The description clearly states the verb 'Generate' and the resource 'Google OAuth authorization URL for Google Health API'. It also includes usage context ('Use this first when no local token exists'), effectively distinguishing it from sibling tools like google_health_exchange_code.

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

Usage Guidelines4/5

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

The description explicitly says 'Use this first when no local token exists', providing clear guidance on when to invoke this tool. It implies that if a token exists, this tool is not needed, but does not explicitly name alternatives.

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/davidmosiah/google-health-mcp'

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