get_posts_by_author_id
Retrieve posts from a specific author by their ID using this tool. Input the author ID and optional limit to fetch results efficiently, aiding in targeted research and analysis.
Instructions
Get posts/drops by a specific author ID.
Args:
author_id: The author ID to search for
limit: Maximum number of results to return (default: 10)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| author_id | Yes | ||
| limit | No |
Input Schema (JSON Schema)
{
"properties": {
"author_id": {
"title": "Author Id",
"type": "string"
},
"limit": {
"default": 10,
"title": "Limit",
"type": "integer"
}
},
"required": [
"author_id"
],
"title": "get_posts_by_author_idArguments",
"type": "object"
}
Implementation Reference
- src/qanon_mcp/__init__.py:402-434 (handler)The handler function decorated with @mcp.tool(), implementing the logic to retrieve and format posts by author_id from the loaded dataset, limiting results and using format_post helper.@mcp.tool() def get_posts_by_author_id(author_id: str, limit: int = 10) -> str: """ Get posts/drops by a specific author ID. Args: author_id: The author ID to search for limit: Maximum number of results to return (default: 10) """ if not author_id: return "Please provide an author ID." results = [] for post in posts: post_author_id = post.get("post_metadata", {}).get("author_id", "") if post_author_id == author_id: results.append(post) if not results: return f"No posts found with author ID '{author_id}'." total_found = len(results) results = results[:limit] output = f"Found {total_found} posts with author ID '{author_id}'. Showing top {len(results)} results:\n\n" for i, post in enumerate(results, 1): output += f"Result {i}:\n{format_post(post)}\n\n" + "-" * 40 + "\n\n" if total_found > limit: output += f"... and {total_found - limit} more posts." return output