Skip to main content
Glama
mailkite

MailKite

Official

mailkite_exchange_oauth_token

Exchange an authorization code for an access token or rotate a refresh token to finish linking your MailKite account.

Instructions

Exchange an authorization code for an access token (or rotate a refresh token) — step 3 of linking. Between steps you send the user's browser to /oauth/authorize with your client_id, redirect_uri, state, and an S256 code_challenge; they sign in with whatever method they already use and approve, and the code comes back to your redirect_uri. Then call getApiKey with the access token and store the key. Requires a management session token.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoauthorization_code grant: the single-use code from the redirect. Expires quickly and is consumed on first use — a replay returns invalid_grant.
client_idNoauthorization_code grant: required. refresh_token grant: optional, but checked against the token's client when supplied.
grant_typeYesWhich exchange to perform.
redirect_uriNoauthorization_code grant: must match the redirect_uri used at /oauth/authorize exactly.
code_verifierNoauthorization_code grant: the PKCE verifier whose S256 hash you sent as code_challenge. Required — there is no non-PKCE path.
refresh_tokenNorefresh_token grant: the token to rotate. Single-use — the old one is revoked and a new one returned alongside the access token.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.20.0

TDQS

A4.1/5.0
Behavior4/5

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

Given annotations (readOnlyHint=false, idempotentHint=false, destructiveHint=false), the description adds valuable behavioral context beyond those hints. It discloses that the authorization code is single-use and expires quickly, with a replay returning invalid_grant. It also notes that the refresh token is single-use and is revoked upon rotation. These details help the agent understand the side effects and constraints of the operation. While it doesn't explicitly state that the operation mutates state (like revoking tokens), the description of token rotation and revocation implies it. No contradiction with annotations.

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 concise and front-loaded: it starts with the core action and positions it as step 3. It then provides necessary context about the OAuth flow in a few sentences. There is no fluff, and each sentence contributes value. It could be slightly more structured by separating the two grant types, but it's still efficient.

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?

Given the complexity of an OAuth exchange with two grant types and six parameters, the description is fairly complete. It explains the overall flow, the need for a management session token, and points to the next step (getApiKey). However, it does not describe the response format (e.g., that it returns tokens), but since there is no output schema, the description could have mentioned what the tool returns. Still, the pointer to getApiKey implies the returned access token is used there. Minor gap, but solid overall.

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%, so the schema already documents each parameter thoroughly. The description adds a bit of context by describing the overall flow but does not provide additional parameter semantics beyond what's in the schema. For example, the schema already describes code_verifier as required and the grant_type enum. The description reinforces the sequence but adds minimal new information about parameters themselves. Baseline 3 is appropriate.

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 tool's purpose: exchanging an authorization code for an access token or rotating a refresh token, and positions it as step 3 of an OAuth linking flow. It mentions specific actions (exchange) and resources (authorization code, access token, refresh token), which distinguishes it from other OAuth-related tools like register_oauth_client and get_api_key.

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 provides a clear sequence: it explains the steps before (sending user to /oauth/authorize with specific parameters) and after (calling getApiKey with the access token and storing the key). It implicitly indicates when to use this tool (after obtaining the authorization code, before obtaining the API key) but does not explicitly mention alternatives or exclusions, which would justify a 5. However, it does mention the requirement of a management session token, which is useful context.

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