Skip to main content
Glama

x_api_get_users_by_username

Fetches a user's public X profile by username. Use to retrieve user ID, name, and metrics for analysis or integration.

Instructions

Get User by username. Use when: Get User by username. Do not use when: a more specific auth/configuration tool is required before the API call or you are only exploring; prefer x_schema_discovery or x_query_suggestion first. Risk: read-only. Required permissions and prerequisites: bearer token; OAuth 2 user token with scopes tweet.read, users.read; OAuth 1a user token Environment-selection behavior: scopeTenantId plus exactly one of scopeUserId or scopeAccountId choose the Vault/Postgres tenant principal used for auth resolution. credentialKey selects a non-default stored credential profile when present. Parameter formats and constraints: username (path, string, required). Expected response shape: { ok, status, data: { method, path, url, status, contentType, authType, data } } Common failure conditions: missing scoped credentials in Vault, missing required API parameters, X API auth failures, rate limits, or unsupported multipart/body shape. Recommended prerequisite and follow-up tools: x_connection_info, x_schema_discovery, x_auth_get_scope_credentials, x_api_request. Safety warnings: This is read-only, but responses can still include sensitive account data depending on granted scopes. Example: {"name":"x_api_get_users_by_username","arguments":{"scopeTenantId":"default","scopeUserId":"default","username":""}}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes
scopeUserIdNo
credentialKeyNo
scopeTenantIdNo
scopeAccountIdNo
authorizationKeyNo
preferredAuthTypeNo
Behavior5/5

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

With no annotations, the description carries the full burden and does exceptionally well. It discloses read-only risk, required permissions (bearer token, OAuth scopes), environment-selection behavior, common failure conditions, and safety warnings about sensitive data. This goes far beyond a simple read-only hint.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

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

The description is well-structured with labeled sections, but it contains redundancy: 'Get User by username' appears in both the opening and 'Use when', and the read-only property is stated twice. While the length is justified by the amount of context, tighter wording would improve it.

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 no annotations and no output schema, the description covers a lot: required permissions, environment behavior, expected response wrapper shape, common failures, and an example call. The inner 'data' object is not detailed (e.g., user fields), but the overall envelope is specified, and the recommendation of prerequisite tools fills additional context.

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 description coverage is 0%, so the description must compensate. It explains the required 'username' parameter and clarifies the roles of scopeTenantId, scopeUserId, scopeAccountId, and credentialKey in environment selection. However, authorizationKey and preferredAuthType are not described, leaving some parameters semantically unexplained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action: 'Get User by username.' This clearly identifies the resource and operation. However, it doesn't distinguish itself from the similar sibling tools x_api_get_users_by_usernames (plural) or x_api_get_users_by_id, relying on the name alone for differentiation.

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?

Provides explicit 'Do not use when' guidance, noting that exploration should prefer x_schema_discovery or x_query_suggestion, and that auth/configuration tools may be needed first. However, the 'Use when' section merely repeats the tautological purpose, and no explicit comparison is made to sibling user lookup tools, leaving a slight gap.

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/LesterAJohn/X-mcp'

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