Skip to main content
Glama

ebay_exchange_authorization_code

Exchange an eBay OAuth authorization code for access and refresh tokens to complete the authorization flow and enable API requests.

Instructions

Exchange an OAuth authorization code for access and refresh tokens. This completes the OAuth 2.0 Authorization Code grant flow. After the user authorizes the application using the URL from ebay_get_oauth_url, eBay redirects back with an authorization code in the URL. Use this tool to exchange that code for tokens that can be used to make API calls. The tokens will be automatically stored and used for subsequent API requests.

IMPORTANT NOTES:

  • Authorization codes expire in ~5 minutes - if you get "invalid grant" error, get a fresh code

  • Codes can be URL-encoded (e.g., v%5E1.1%23...) - this tool automatically decodes them

  • Extract the code parameter from the redirect URL (your RuName Accept URL): https://your-redirect-uri?code=YOUR_CODE&expires_in=299

  • Tokens are saved to .env file and will auto-refresh every 2 hours

  • Refresh tokens last 18 months before requiring re-authorization

COMMON ERRORS:

  • "invalid or was issued to another client": Code expired, get fresh code

  • "Insufficient permissions": Re-run OAuth flow with additional scopes in ebay_get_oauth_url

For complete OAuth guide with scopes, troubleshooting, and examples, see: docs/auth/OAUTH_QUICK_REFERENCE.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe authorization code received from eBay after user authorization
Behavior5/5

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

No annotations provided, so description fully carries behavioral disclosure. Reveals automatic token storage and usage, code expiration (~5 minutes), URL decoding, .env file saving with auto-refresh every 2 hours, and refresh token duration (18 months). 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with sections, important notes, and common errors. Length is justified by the needed detail for OAuth flow; no redundancy.

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 single-parameter tool with no output schema, the description is complete. Covers the full OAuth flow, token handling, error scenarios, and references a documentation file. No gaps.

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?

Single parameter 'code' has schema description 'The authorization code received from eBay after user authorization'. Description adds extraction details, URL-encoding, and expiration context, going beyond schema. High schema coverage (100%) means baseline is 3, but added value justifies 4.

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 exchanges an OAuth authorization code for access and refresh tokens, completing the OAuth 2.0 Authorization Code grant flow. It distinguishes itself from sibling tools as the only OAuth token exchange tool among many eBay API 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?

Explicitly describes when to use (after user authorization and receiving code) and how to extract the code from the redirect URL. Includes common errors with troubleshooting guidance. Does not explicitly state when not to use, but context is sufficient.

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/YosefHayim/ebay-mcp'

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