Skip to main content
Glama

Exchange Alza OAuth code

auth_exchange

Exchange the OAuth authorization code from the redirect for mobile API tokens, completing sign-in and authenticating account tools like cart, profile, and orders.

Instructions

Complete the OAuth 2.0 PKCE sign-in: exchange the authorization code for mobile API tokens and load them into this server. Use immediately after the user finishes the auth_start flow in the browser. Pass exactly the code and state from the alza://identity redirect — never a password and never a refresh token here. Fails if the state does not match a pending auth_start session (start over from auth_start in that case). Side effect: replaces the token set currently loaded in this process; afterwards account tools such as cart, profile, and order are authenticated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesAuthorization code from the `alza://identity` redirect (the `code` query parameter).
stateYesState value returned by `auth_start`; must match the pending PKCE session exactly.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errNo
msgNo
dataNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.9/5.0
Behavior5/5

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

The description discloses a significant side effect: it replaces the currently loaded token set and thereby authenticates downstream account tools. It also explains failure behavior when the state does not match a pending session. This goes well beyond the annotations, which only signal readOnly=false and idempotent=false.

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?

Three dense sentences with no filler. The core action and sequencing appear first, failure handling second, and side effects last, so the most decision-relevant information is front-loaded.

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

Completeness5/5

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

For a two-parameter OAuth exchange tool with an output schema, the description covers the workflow context, failure recovery, side effects, and downstream authentication state. Nothing an agent needs to decide whether and how to invoke it is missing.

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 schema already documents both parameters with 100% coverage, so the baseline is 3. The description adds value by saying to pass exactly the `code` and `state` from the `alza://identity` redirect and explicitly prohibiting passwords and refresh tokens here, which helps avoid common misuse.

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 names a specific verb ('exchange'), a specific resource ('authorization code for mobile API tokens'), and a clear outcome ('load them into this server'). It also distinguishes this tool from `auth_start`, making its role in the OAuth flow unmistakable.

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

Usage Guidelines5/5

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

It explicitly says when to use it ('immediately after the user finishes the `auth_start` flow'), what inputs to pass from the redirect, and what to do on failure ('start over from `auth_start`'). This is direct, actionable usage guidance with no ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.