get_user_actions
Retrieve a user's activity feed from USCardForum with filtering options for likes, posts, topics, replies, and mentions to analyze detailed participation.
Instructions
Fetch a user's activity feed with optional filtering.
Args:
username: The user's handle
filter: Action type filter (optional). Common values:
- 1: Likes given
- 2: Likes received
- 4: Topics created
- 5: Replies posted
- 6: Posts (all)
- 7: Mentions
offset: Pagination offset (0, 30, 60, ...)
Returns a list of UserAction objects showing what the user has done.
Use this for detailed activity analysis beyond just replies.
For most cases, get_user_replies or get_user_topics are simpler.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | The user's handle | |
| filter | No | Action type filter: 1=likes given, 2=likes received, 4=topics created, 5=replies posted, 6=all posts, 7=mentions | |
| offset | No | Pagination offset (0, 30, 60, ...) |
Implementation Reference
- The MCP tool handler for 'get_user_actions'. Decorated with @mcp.tool(), it defines the input schema via Annotated Field descriptions and return type list[UserAction]. Delegates to the DiscourseClient for execution.@mcp.tool() def get_user_actions( username: Annotated[ str, Field(description="The user's handle"), ], filter: Annotated[ int | None, Field( default=None, description="Action type filter: 1=likes given, 2=likes received, 4=topics created, 5=replies posted, 6=all posts, 7=mentions", ), ] = None, offset: Annotated[ int | None, Field(default=None, description="Pagination offset (0, 30, 60, ...)"), ] = None, ) -> list[UserAction]: """ Fetch a user's activity feed with optional filtering. Args: username: The user's handle filter: Action type filter (optional). Common values: - 1: Likes given - 2: Likes received - 4: Topics created - 5: Replies posted - 6: Posts (all) - 7: Mentions offset: Pagination offset (0, 30, 60, ...) Returns a list of UserAction objects showing what the user has done. Use this for detailed activity analysis beyond just replies. For most cases, get_user_replies or get_user_topics are simpler. """ return get_client().get_user_actions(username, filter=filter, offset=offset)
- src/uscardforum/api/users.py:85-111 (helper)Low-level API implementation in UsersAPI that performs the HTTP GET to /user_actions.json, constructs query params, parses JSON response, and instantiates UserAction models.def get_user_actions( self, username: str, *, filter: int | None = None, offset: int | None = None, ) -> list[UserAction]: """Fetch user actions/activity. Args: username: User handle filter: Optional action filter (e.g., 5 for replies) offset: Optional pagination offset Returns: List of user action objects """ params_list: list[tuple[str, Any]] = [("username", username)] if filter is not None: params_list.append(("filter", int(filter))) if offset is not None: params_list.append(("offset", int(offset))) payload = self._get("/user_actions.json", params=params_list) actions = payload.get("user_actions", []) return [UserAction(**a) for a in actions]
- src/uscardforum/client.py:324-341 (helper)Client wrapper method that delegates to the UsersAPI.get_user_actions.def get_user_actions( self, username: str, *, filter: int | None = None, offset: int | None = None, ) -> list[UserAction]: """Fetch user actions/activity. Args: username: User handle filter: Optional action filter (e.g., 5 for replies) offset: Optional pagination offset Returns: List of user action objects """ return self._users.get_user_actions(username, filter=filter, offset=offset)
- src/uscardforum/server.py:15-45 (registration)Imports the get_user_actions tool function (along with others) from server_tools, which triggers MCP registration when the server module is imported/executed.from uscardforum.server_tools import ( analyze_user, bookmark_post, compare_cards, find_data_points, get_all_topic_posts, get_categories, get_current_session, get_hot_topics, get_new_topics, get_notifications, get_top_topics, get_topic_info, get_topic_posts, get_user_actions, get_user_badges, get_user_followers, get_user_following, get_user_reactions, get_user_replies, get_user_summary, get_user_topics, list_users_with_badge, login, research_topic, resource_categories, resource_hot_topics, resource_new_topics, search_forum, subscribe_topic, )
- Imports the UserAction Pydantic model used for input/output typing and validation in the tool handler.UserAction, UserBadges, UserReactions, UserSummary,