Skip to main content
Glama

Exchange Polar OAuth Code

polar_exchange_code

Exchange a Polar OAuth authorization code for local tokens; requires user-completed browser OAuth and stores tokens with 0600 permissions, never returning them.

Instructions

Exchange a Polar OAuth authorization code for local tokens. Tokens are stored locally with 0600 permissions and are never returned. Requires explicit user action: the user must complete browser OAuth and supply the authorization code (agents must not invent codes).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesOAuth authorization code, or a full redirect URL containing ?code=...
response_formatNomarkdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
noteYes
scopeNo
expires_atNo
token_pathYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.5.4
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. First observedv0.3.6

TDQS

A4.2/5.0
Behavior4/5

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

Adds substantive behavior beyond the annotations: tokens are persisted locally with 0600 permissions and are never returned to the caller. That is security-relevant context the openWorldHint/idempotentHint flags do not convey. It does not cover failure modes or what happens to previously stored tokens on re-exchange, keeping it short of a 5.

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?

Two sentences, front-loaded with the core action, followed by the storage guarantee and the user prerequisite. No filler; every clause adds information the agent needs.

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?

With an output schema present, return values need not be explained, and the description still clarifies that no token value is surfaced. Combined with the annotations and the security/permission note, an agent has enough to invoke this correctly; only error and re-exchange behavior are unaddressed.

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 coverage is exactly 50%: the required `code` parameter is well documented in the schema (including the full-redirect-URL form), while `response_format` is an undescribed enum. The description only restates 'authorization code' and adds no format, validation, or output-shaping detail beyond the schema, so the baseline 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?

States a precise verb+resource pair: exchange an OAuth authorization code for local tokens. This clearly distinguishes it from the sibling polar_get_auth_url (which starts the flow) and from all the polar_list_* read tools.

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?

Explicit precondition and workflow context: the user must complete browser OAuth first, and agents must not invent codes. This tells the agent when the tool is applicable and guards against a common misuse, though it never names the sibling tool (polar_get_auth_url) that produces the code.

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