Home / Servers / X (Twitter) API / get_users_by_username

Get User by Username

An MCP tool from the X (Twitter) API server, hosted on mcp.hjlabs.in.

Get User by Username Retrieves details of a specific User by their username. [GET /2/users/by/username/{username}]

Name on the gateway: x_api__get_users_by_username · read-only.

Parameters

NameTypeDescription
username requiredstringusername parameter
user.fieldsarrayA comma separated list of User fields to display.
expansionsarrayA comma separated list of fields to expand.
post.fieldsarrayA comma separated list of Post fields to display.

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "x_api__get_users_by_username",
  "arguments": {
    "username": "…"
  }
}

Or connect the X (Twitter) API server directly, which lists 258 tools including this one:

Run in your terminal
claude mcp add --transport http hj-x-api https://mcp.hjlabs.in/mcp/x-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the get user by username tool with username set to ….

More from X (Twitter) API