Skip to main content
Glama
TwitterAPIs

twitterapis

twitter_user_login

Log in to X with username and password, optionally adding TOTP for 2FA, to store a server-side session for authenticated account actions.

Instructions

Log in to X with a username and password (plus totp_secret if the account has 2FA) and store the resulting session against your API key, so the authenticated-account reads and the write tools then act as that account. On success returns { ok, username, message }; it does NOT return the session cookies (auth_token/ct0 are minted and kept server-side, never sent back). Typical failures: bad_credentials (401), two_factor_required (400, add totp_secret), captcha_required (422), acid_challenge (409, confirm the login from the account then retry). This handles real account credentials; never log or echo the values you pass.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
passwordYesThe X account password.
usernameYesThe X account username/handle (without the leading @). Some accounts also accept the login email here.
proxy_urlNoOptional. HTTP or SOCKS proxy URL to perform the login through, e.g. 'http://user:pass@host:port'. Stored with the session and reused for its later requests. Omit to log in directly from the service's own IP. A residential proxy is recommended: X treats datacenter logins as automated.
user_agentNoOptional. Browser User-Agent to mint and use the session with. Defaults to a current Chrome UA. Keep it consistent with the environment the account normally signs in from; a mismatch between the UA and the session is itself a signal to X.
totp_secretNoThe account's base32 two-factor (TOTP) secret. Required only when the account has 2FA enabled.
Behavior5/5

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

Beyond annotations (readOnlyHint=false, destructiveHint=false), the description discloses that it stores a session server-side and does not return cookies, warns against logging credentials, and lists typical failure states (bad_credentials, two_factor_required, etc.). This is valuable transparency beyond what annotations provide.

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 a single dense yet compact paragraph that efficiently packs key info: purpose, dependencies, return format, typical failures, and security advice. It is front-loaded with the core purpose and doesn't include filler. Slightly dense but concise overall.

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 complexity (5 parameters, no output schema), the description fully covers the needed context: what it does, what it doesn't return, typical error codes with suggestions, and critical security warnings. It leaves no major gaps for an agent to misuse the tool.

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?

With 100% schema description coverage, the schema already documents each parameter. The description adds context: totp_secret is only required if 2FA, proxy_url is recommended to be a residential proxy (X treats datacenter logins as automated), user_agent should match the account's typical environment. These additional notes enhance parameter understanding beyond the schema.

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 uses a specific verb 'Log in' and targets the resource 'X' (account). It clearly states the purpose: authenticate and store the session for subsequent authenticated reads/writes. It distinguishes from siblings (e.g., twitter_account_me) by being the login action and explicitly not returning session cookies.

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?

It provides clear context for when to use: to authenticate before other account-scoped tools. It gives typical failure codes and how to resolve them. It doesn't explicitly mention when not to use or alternatives, but given the sibling set, there is no obvious alternative. Thus it lacks explicit exclusions but still useful.

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/TwitterAPIs/twitterapis-mcp'

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