get_user_topics
Fetch topics created by a specific user on USCardForum to analyze their discussion history, identify expertise areas, and research user interests.
Instructions
Fetch topics created by a specific user.
Args:
username: The user's handle
page: Page number for pagination (optional)
Returns a list of topic objects with:
- id: Topic ID
- title: Topic title
- posts_count: Number of replies
- views: View count
- created_at: When created
- category_id: Forum category
Use this to:
- See what discussions a user has initiated
- Find expert users in specific areas
- Research a user's areas of interest
Paginate by incrementing the page parameter.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | The user's handle | |
| page | No | Page number for pagination |
Implementation Reference
- MCP tool handler for 'get_user_topics'. Defines input schema (username: str, page: int|None), output as list[dict], docstring with details. Delegates execution to DiscourseClient.get_user_topics.@mcp.tool() def get_user_topics( username: Annotated[ str, Field(description="The user's handle"), ], page: Annotated[ int | None, Field(default=None, description="Page number for pagination"), ] = None, ) -> list[dict[str, Any]]: """ Fetch topics created by a specific user. Args: username: The user's handle page: Page number for pagination (optional) Returns a list of topic objects with: - id: Topic ID - title: Topic title - posts_count: Number of replies - views: View count - created_at: When created - category_id: Forum category Use this to: - See what discussions a user has initiated - Find expert users in specific areas - Research a user's areas of interest Paginate by incrementing the page parameter. """ return get_client().get_user_topics(username, page=page)
- Input/output schema defined via Pydantic Annotated Fields and return type annotation. Docstring specifies expected output fields: id, title, posts_count, views, created_at, category_id.@mcp.tool() def get_user_topics( username: Annotated[ str, Field(description="The user's handle"), ], page: Annotated[ int | None, Field(default=None, description="Page number for pagination"), ] = None, ) -> list[dict[str, Any]]: """ Fetch topics created by a specific user. Args: username: The user's handle page: Page number for pagination (optional) Returns a list of topic objects with: - id: Topic ID - title: Topic title - posts_count: Number of replies - views: View count - created_at: When created - category_id: Forum category Use this to: - See what discussions a user has initiated - Find expert users in specific areas - Research a user's areas of interest Paginate by incrementing the page parameter. """ return get_client().get_user_topics(username, page=page)
- src/uscardforum/api/users.py:128-151 (helper)Core API implementation in UsersAPI: performs HTTP GET to /topics/created-by/{username}.json with optional page param, extracts topics from payload.def get_user_topics( self, username: str, page: int | None = None, ) -> list[dict[str, Any]]: """Fetch topics created by user. Args: username: User handle page: Optional page number Returns: List of topic objects (raw API format) """ params_list: list[tuple[str, Any]] = [] if page is not None: params_list.append(("page", int(page))) payload = self._get( f"/topics/created-by/{username}.json", params=params_list, ) return payload.get("topic_list", {}).get("topics", [])
- src/uscardforum/client.py:359-375 (helper)DiscourseClient wrapper: calls UsersAPI.get_user_topics and enriches results with category names using _enrich_with_categories.def get_user_topics( self, username: str, page: int | None = None, ) -> list[dict[str, Any]]: """Fetch topics created by user. Args: username: User handle page: Optional page number Returns: List of topic objects """ topics = self._users.get_user_topics(username, page=page) return self._enrich_with_categories(topics)
- src/uscardforum/server_tools/__init__.py:37-47 (registration)Re-exports get_user_topics from users.py as part of server_tools public API, making it available for import in server.py.from .users import ( get_user_summary, get_user_topics, get_user_replies, get_user_actions, get_user_badges, get_user_following, get_user_followers, get_user_reactions, list_users_with_badge, )