Skip to main content
Glama

ebay_exchange_authorization_code

Exchange an OAuth authorization code for access and refresh tokens to complete the OAuth 2.0 Authorization Code grant flow. The tokens are automatically stored for subsequent API calls.

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. This is the "code" parameter in the redirect URL.
Behavior5/5

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

With no annotations, the description fully discloses behavioral traits: code auto-decoding, token storage to .env, auto-refresh every 2 hours, refresh token lifespan of 18 months, and error conditions. This provides complete transparency for safe invocation.

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 concise and well-structured, with a clear opening sentence, bullet-pointed important notes, and a section for common errors. Every sentence provides necessary information without 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?

Given the tool's single parameter and no output schema, the description covers all needed context: the OAuth flow sequence, token lifecycle, error handling, and references a detailed guide. It is fully complete for an agent to use correctly.

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 covers the 'code' parameter with a clear description. The description adds valuable context: codes can be URL-encoded and are auto-decoded, and explains how to extract the code from the redirect URL, going beyond schema basics.

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 function: 'Exchange an OAuth authorization code for access and refresh tokens.' It specifies the OAuth grant flow and distinguishes from related tools like ebay_get_oauth_url and ebay_refresh_access_token by context.

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 explains when to use this tool (after receiving authorization code from ebay_get_oauth_url) and provides important notes about code expiration (5 minutes) and common errors. It does not explicitly contrast with other tools but the context is clear enough for proper usage.

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