get_categories
Retrieve a complete mapping of forum categories to organize topics by subject area, enabling users to filter search results and navigate specific sections like credit card applications, bank bonuses, and travel discussions.
Instructions
Get a mapping of all forum categories.
Returns a CategoryMap object with category_id to category name mapping.
Categories organize topics by subject area.
Common USCardForum categories include sections for:
- Credit card applications and approvals
- Bank account bonuses
- Travel and redemptions
- Data points and experiences
Use category IDs to:
- Filter search results by category
- Understand which section a topic belongs to
- Navigate to specific areas of interest
The mapping includes both main categories and subcategories.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- MCP tool handler for get_categories: decorated function that fetches and returns CategoryMap using get_client().@mcp.tool() def get_categories() -> CategoryMap: """ Get a mapping of all forum categories. Returns a CategoryMap object with category_id to category name mapping. Categories organize topics by subject area. Common USCardForum categories include sections for: - Credit card applications and approvals - Bank account bonuses - Travel and redemptions - Data points and experiences Use category IDs to: - Filter search results by category - Understand which section a topic belongs to - Navigate to specific areas of interest The mapping includes both main categories and subcategories. """ return get_client().get_category_map() __all__ = ["get_categories"]
- src/uscardforum/server.py:15-45 (registration)Import of get_categories (line 21) in server.py registers the tool for the MCP server.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, )
- Pydantic BaseModel CategoryMap defines the output schema for the tool: dict[int, str] of category_id to name.class CategoryMap(BaseModel): """Mapping of category IDs to names.""" categories: dict[int, str] = Field( default_factory=dict, description="ID to name mapping" ) def get_name(self, category_id: int) -> str | None: """Get category name by ID.""" return self.categories.get(category_id) def __getitem__(self, category_id: int) -> str: """Get category name by ID.""" return self.categories[category_id] def __contains__(self, category_id: int) -> bool: """Check if category ID exists.""" return category_id in self.categories def items(self): """Iterate over category mappings.""" return self.categories.items()