Skip to main content
Glama
arpitbatra123

Google Tasks MCP Server

set-auth-code

Configure Google Tasks access by entering the OAuth authorization code to authenticate with Google's API.

Instructions

Set the authentication code received from Google OAuth flow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe authentication code received from Google

Implementation Reference

  • The handler function for the 'set-auth-code' tool. It exchanges the provided OAuth code for access and refresh tokens using Google OAuth2Client, stores the credentials in memory, closes the temporary auth server, and returns a success message or an error if token retrieval fails.
    async ({ code }) => {
      try {
        const { tokens } = await oauth2Client.getToken(code);
        oauth2Client.setCredentials(tokens);
        
        // Store tokens in memory only
        credentials = tokens;
        
        // Close auth server if it's still running
        if (authServer) {
          try {
            authServer.close();
          } catch (error) {
            console.error('Error closing auth server:', error);
          }
          authServer = null;
        }
        
        return {
          content: [
            {
              type: "text",
              text: "Authentication successful! You can now use the Google Tasks tools.",
            },
          ],
        };
      } catch (error) {
        console.error('Error retrieving access token:', error);
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Authentication failed: ${error}`,
            },
          ],
        };
      }
    }
  • Input schema for the 'set-auth-code' tool, defining a required 'code' parameter as a string using Zod.
    {
      code: z.string().describe("The authentication code received from Google"),
    },
  • src/index.ts:139-184 (registration)
    Registration of the 'set-auth-code' tool using server.tool(), including name, description, input schema, and inline handler function.
    server.tool(
      "set-auth-code",
      "Set the authentication code received from Google OAuth flow",
      {
        code: z.string().describe("The authentication code received from Google"),
      },
      async ({ code }) => {
        try {
          const { tokens } = await oauth2Client.getToken(code);
          oauth2Client.setCredentials(tokens);
          
          // Store tokens in memory only
          credentials = tokens;
          
          // Close auth server if it's still running
          if (authServer) {
            try {
              authServer.close();
            } catch (error) {
              console.error('Error closing auth server:', error);
            }
            authServer = null;
          }
          
          return {
            content: [
              {
                type: "text",
                text: "Authentication successful! You can now use the Google Tasks tools.",
              },
            ],
          };
        } catch (error) {
          console.error('Error retrieving access token:', error);
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Authentication failed: ${error}`,
              },
            ],
          };
        }
      }
    );
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 states what the tool does (sets an auth code) but doesn't describe the behavioral implications: whether this persists credentials, what authentication state results, whether it's idempotent, or what happens if called multiple times. For a security-sensitive authentication tool with zero annotation coverage, this is a significant gap in transparency.

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 that communicates the core purpose without unnecessary words. It's appropriately sized for a single-parameter tool and front-loads the essential information. Every word earns its place, making this an excellent example of conciseness.

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 an authentication-related tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens after setting the code, whether authentication is established, what errors might occur, or how this integrates with the broader OAuth flow. Given the security sensitivity and the lack of structured metadata, more contextual information would be valuable.

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 100%, with the single parameter 'code' well-described in the schema as 'The authentication code received from Google'. The description adds no additional parameter semantics beyond what's already in the schema. This meets the baseline of 3 when schema coverage is high, but doesn't provide extra value like format examples or validation details.

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 action ('Set') and the resource ('authentication code received from Google OAuth flow'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'authenticate', but the specific focus on setting an OAuth code provides reasonable distinction. The description goes beyond a tautology by specifying the source (Google OAuth flow).

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 'authenticate', nor does it mention prerequisites or context for usage. While it implies this is part of an OAuth flow, it doesn't specify when in that flow this should be called or what happens before/after. There's no explicit when/when-not guidance or alternative tool references.

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/arpitbatra123/mcp-googletasks'

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