Skip to main content
Glama
TwitterAPIs

twitterapis

twitter_community_memberships

Read-only

List all communities a user belongs to by providing their numeric X user id. Returns full community objects with member counts, rules, and topic, paginated via cursor. Empty array means no memberships.

Instructions

The INVERSE community lookup: given a numeric X USER id, list the communities that account belongs to, cursor-paginated. Every other community tool starts from a community; this one starts from an account, which makes it the tool for profiling which audiences a person sits inside. Each row is the FULL community object (the same shape twitter_community_info returns, with member counts, rules, topic, policies, admin and creator), so no follow-up call per community is needed. Takes a numeric user id ONLY, not a @handle: resolve a handle with twitter_user_info first, because resolving it here would silently cost a second call. An EMPTY communities array is a real, successful answer (the account is in no communities), not a not-found. As on twitter_community_info, role / can_join / is_pinned / viewer_relationship_type are always null on every community returned, because this is a pooled read.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoMax communities to return for this page. Defaults to 20 and is clamped to 1-100.
cursorNoOpaque pagination cursor from a previous response's next_cursor field. Omit on the first call.
user_idYesNumeric X user id, e.g. '1281109705495130113'. NOT a @handle and NOT a community id. Resolve a handle to its id with twitter_user_info first.
Behavior5/5

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

Annotations declare readOnlyHint=true and destructiveHint=false, but the description goes far beyond that. It reveals that this is a 'pooled read' and that role/can_join/is_pinned/viewer_relationship_type are always null. It also discloses that an empty array is a real success, not an error, and that the result includes the full community object shape. This adds substantial behavioral context that annotations alone do not provide, and it does not contradict them.

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 relatively long but every sentence earns its place: it starts with the core purpose, then differentiates from siblings, explains the return shape, warns about the id type, clarifies empty results, and notes pooled-read quirks. It is front-loaded with the primary use case. Though not the shortest, the density of essential information justifies its length.

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?

Despite having no output schema, the description fully explains what the caller will receive: 'Each row is the FULL community object (the same shape twitter_community_info returns...), so no follow-up call per community is needed.' It also covers pagination via cursor, the empty-array case, and the null fields on pooled reads. For a 3-parameter tool with no output schema, this is highly complete and self-sufficient.

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?

Schema description coverage is 100%, so the schema already documents all three parameters clearly. The description adds extra value by emphasizing that user_id is NOT a @handle and NOT a community id, and by recommending resolving a handle with twitter_user_info first to avoid a hidden second call. It also confirms count defaults and clamping, reinforcing the schema. This exceeds the baseline of 3 for high coverage.

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 purpose: 'given a numeric X USER id, list the communities that account belongs to'. It uses a specific verb (list) and resource (communities) and explicitly differentiates from other community tools by calling itself the 'INVERSE community lookup' and noting that every other community tool starts from a community, while this one starts from an account. This fully distinguishes it among siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit when-to-use guidance: 'makes it the tool for profiling which audiences a person sits inside'. It also provides when-not-to-use details: 'Takes a numeric user id ONLY, not a @handle: resolve a handle with twitter_user_info first' and warns about the cost of resolving a handle here. It also clarifies that an empty array is a successful answer, not a not-found, which prevents misinterpretation. These are strong usage guidelines.

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