Skip to main content
Glama
jjmerri

E*TRADE MCP Server

by jjmerri

etrade_get_auth_url

Generate E*TRADE OAuth authorization URL to begin authentication process for accessing market data and trading APIs.

Instructions

Get E*TRADE OAuth authorization URL. This is the first step in authentication - returns a URL for the user to visit.

Returns: Authorization URL that the user should visit in their browser

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler for etrade_get_auth_url tool. Gets auth instance, request token, builds and returns the authorization URL with instructions.
    @mcp.tool()
    def etrade_get_auth_url() -> str:
        """
        Get E*TRADE OAuth authorization URL.
        This is the first step in authentication - returns a URL for the user to visit.
        
        Returns:
            Authorization URL that the user should visit in their browser
        """
        global _request_token, _request_token_secret
        
        auth = get_auth()
        _request_token, _request_token_secret = auth.get_request_token()
        authorize_url = auth.get_authorize_url(_request_token)
        
        return f"Please visit this URL and authorize the application:\n{authorize_url}\n\nAfter authorizing, you will receive a verification code. Use etrade_authenticate with that code."
  • Tool registration decorator @mcp.tool() for etrade_get_auth_url.
    @mcp.tool()
  • Function signature and docstring defining input (none) and output (str: auth URL).
    def etrade_get_auth_url() -> str:
        """
        Get E*TRADE OAuth authorization URL.
        This is the first step in authentication - returns a URL for the user to visit.
        
        Returns:
            Authorization URL that the user should visit in their browser
        """
  • Helper to get or initialize the global ETradeAuth instance.
    def get_auth() -> ETradeAuth:
        """Get or create auth instance"""
        global _auth
        if _auth is None:
            consumer_key = os.getenv("ETRADE_CONSUMER_KEY")
            consumer_secret = os.getenv("ETRADE_CONSUMER_SECRET")
            environment = os.getenv("ETRADE_ENVIRONMENT", "sandbox")
            
            if not consumer_key or not consumer_secret:
                raise ValueError(
                    "ETRADE_CONSUMER_KEY and ETRADE_CONSUMER_SECRET must be set in environment variables"
                )
            
            _auth = ETradeAuth(consumer_key, consumer_secret, environment)
        return _auth
  • ETradeAuth.get_request_token() method called by the handler to obtain OAuth request token and secret.
    def get_request_token(self) -> Tuple[str, str]:
        """
        Get OAuth request token
        
        Returns:
            Tuple of (request_token, request_token_secret)
        """
        request_token, request_token_secret = self.oauth_service.get_request_token(
            params={"oauth_callback": "oob", "format": "json"}
        )
        return request_token, request_token_secret
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool returns a URL for user interaction and is part of an OAuth flow, which is useful behavioral context. However, it lacks details on error handling, rate limits, or authentication prerequisites, leaving gaps in transparency.

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 front-loaded with the core purpose in the first sentence, followed by additional context and return details. Every sentence adds value without redundancy, making it efficiently structured and appropriately sized for the tool's complexity.

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 tool's low complexity (0 parameters, output schema exists), the description is largely complete, covering purpose, usage, and return value. However, with no annotations, it could benefit from more behavioral details like error cases or integration steps with etrade_authenticate, slightly reducing completeness.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately does not discuss parameters, earning a high baseline score. It could slightly improve by noting the absence of parameters, but this is minor.

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 specific action ('Get E*TRADE OAuth authorization URL') and resource ('URL'), distinguishing it from sibling tools like etrade_authenticate (which likely uses the URL) and other data retrieval tools. It precisely communicates the tool's function as the first authentication step.

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 explicitly states when to use this tool ('first step in authentication'), providing clear context. However, it does not specify when not to use it or name alternatives, such as whether to use etrade_authenticate directly in some scenarios, which prevents a perfect score.

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/jjmerri/etrade-mcp'

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