search_forum
Search USCardForum for credit card and points discussions using advanced query operators to filter by title, author, category, tags, or date.
Instructions
Search USCardForum for topics and posts matching a query.
Args:
query: Search query string. Supports Discourse operators:
- Basic: "chase sapphire bonus"
- In title only: "chase sapphire in:title"
- By author: "@username chase"
- In category: "category:credit-cards chase"
- With tag: "#amex bonus"
- Exact phrase: '"sign up bonus"'
- Exclude: "chase -sapphire"
- Time: "after:2024-01-01" or "before:2024-06-01"
page: Page number for pagination (starts at 1)
order: Sort order for results. Options:
- "relevance": Best match (default)
- "latest": Most recent first
- "views": Most viewed
- "likes": Most liked
- "activity": Recent activity
- "posts": Most replies
Returns a SearchResult object with:
- posts: List of matching SearchPost objects with excerpts
- topics: List of matching SearchTopic objects
- users: List of matching SearchUser objects
- grouped_search_result: Metadata about result counts
Example queries:
- "Chase Sapphire Reserve order:latest" - Recent CSR discussions
- "AMEX popup in:title" - Topics about AMEX popup in title
- "data point category:credit-cards" - Data points in CC category
- "@expert_user order:likes" - Most liked posts by a user
Pagination: If more results exist, increment page parameter.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query string. Supports operators: 'in:title', '@username', 'category:name', '#tag', 'after:date', 'before:date' | |
| page | No | Page number for pagination (starts at 1) | |
| order | No | Sort order: 'relevance' (default), 'latest', 'views', 'likes', 'activity', or 'posts' |
Implementation Reference
- Core handler for the 'search_forum' MCP tool. Includes inline input schema definitions using Pydantic's Annotated and Field for parameters query, page, order. Executes forum search via get_client().search() and returns SearchResult object.@mcp.tool() def search_forum( query: Annotated[ str, Field( description="Search query string. Supports operators: 'in:title', '@username', 'category:name', '#tag', 'after:date', 'before:date'" ), ], page: Annotated[ int | None, Field(default=None, description="Page number for pagination (starts at 1)"), ] = None, order: Annotated[ str | None, Field( default=None, description="Sort order: 'relevance' (default), 'latest', 'views', 'likes', 'activity', or 'posts'", ), ] = None, ) -> SearchResult: """ Search USCardForum for topics and posts matching a query. Args: query: Search query string. Supports Discourse operators: - Basic: "chase sapphire bonus" - In title only: "chase sapphire in:title" - By author: "@username chase" - In category: "category:credit-cards chase" - With tag: "#amex bonus" - Exact phrase: '"sign up bonus"' - Exclude: "chase -sapphire" - Time: "after:2024-01-01" or "before:2024-06-01" page: Page number for pagination (starts at 1) order: Sort order for results. Options: - "relevance": Best match (default) - "latest": Most recent first - "views": Most viewed - "likes": Most liked - "activity": Recent activity - "posts": Most replies Returns a SearchResult object with: - posts: List of matching SearchPost objects with excerpts - topics: List of matching SearchTopic objects - users: List of matching SearchUser objects - grouped_search_result: Metadata about result counts Example queries: - "Chase Sapphire Reserve order:latest" - Recent CSR discussions - "AMEX popup in:title" - Topics about AMEX popup in title - "data point category:credit-cards" - Data points in CC category - "@expert_user order:likes" - Most liked posts by a user Pagination: If more results exist, increment page parameter. """ return get_client().search(query, page=page, order=order)
- src/uscardforum/server_tools/__init__.py:26-26 (registration)Key import statement in server_tools __init__.py that loads the search_forum tool from its module, triggering the @mcp.tool() decorator registration.from .search import search_forum
- src/uscardforum/server.py:43-43 (registration)Import of search_forum in the main server.py entrypoint from server_tools, ensuring the tool is available and registered in the MCP server.search_forum,
- src/uscardforum/server_tools/__init__.py:72-72 (registration)Explicit inclusion of 'search_forum' in __all__ of server_tools/__init__.py for convenient re-export and usage."search_forum",