Skip to main content
Glama
jkingsman

https://github.com/jkingsman/qanon-mcp-server

get_posts_by_date

Retrieve QAnon posts within a specific date range for sociological analysis by providing start and end dates.

Instructions

Get posts/drops within a specific date range.

Args:
    start_date: Start date in YYYY-MM-DD format
    end_date: End date in YYYY-MM-DD format (defaults to start_date if not provided)
    limit: Maximum number of results to return (default: 10)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYes
end_dateNo
limitNo

Implementation Reference

  • The primary handler for the 'get_posts_by_date' tool. Decorated with @mcp.tool() for registration. Validates dates, calls helper to fetch posts, limits results, formats output using format_post, and returns a formatted string.
    @mcp.tool()
    def get_posts_by_date(start_date: str, end_date: str = None, limit: int = 10) -> str:
        """
        Get posts/drops within a specific date range.
    
        Args:
            start_date: Start date in YYYY-MM-DD format
            end_date: End date in YYYY-MM-DD format (defaults to start_date if not provided)
            limit: Maximum number of results to return (default: 10)
        """
        if not end_date:
            end_date = start_date
    
        try:
            # Validate date format
            datetime.strptime(start_date, "%Y-%m-%d")
            datetime.strptime(end_date, "%Y-%m-%d")
        except ValueError:
            return "Invalid date format. Please use YYYY-MM-DD format."
    
        results = get_posts_by_date_range(start_date, end_date)
    
        if not results:
            return f"No posts found between {start_date} and {end_date}."
    
        total_found = len(results)
        results = results[:limit]
    
        output = f"Found {total_found} posts between {start_date} and {end_date}. 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
  • Core helper function that filters the global 'posts' list by timestamp within the given date range, converting dates to timestamps for comparison.
    def get_posts_by_date_range(start_date: str, end_date: str) -> List[Dict]:
        """Get posts within a date range (YYYY-MM-DD format)."""
        try:
            start_timestamp = int(datetime.strptime(start_date, "%Y-%m-%d").timestamp())
            end_timestamp = (
                int(datetime.strptime(end_date, "%Y-%m-%d").timestamp()) + 86400
            )  # Add a day in seconds
    
            results = []
            for post in posts:
                post_time = post.get("post_metadata", {}).get("time", 0)
                if start_timestamp <= post_time <= end_timestamp:
                    results.append(post)
            return results
        except ValueError:
            return []
  • Utility function used by the handler to format individual posts into a readable string, including metadata, text, images, and referenced posts.
    def format_post(post: Dict) -> str:
        """Format a post for display."""
        metadata = post.get("post_metadata", {})
        post_id = metadata.get("id", "Unknown")
        author = metadata.get("author", "Unknown")
        author_id = metadata.get("author_id", "Unknown")
        tripcode = metadata.get("tripcode", "Unknown")
    
        source = metadata.get("source", {})
        board = source.get("board", "Unknown")
        site = source.get("site", "Unknown")
    
        timestamp = metadata.get("time", 0)
        date_str = (
            datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
            if timestamp
            else "Unknown"
        )
    
        text = post.get("text", "")
        if text:
            # Replace '\n' string literals with actual newlines
            text = text.replace("\\n", "\n")
    
        # Format images
        images_section = ""
        images = post.get("images", [])
        if images:
            images_section = "\nImages:\n"
            for img in images:
                images_section += f"- File: {img.get('file', 'Unknown')}, Name: {img.get('name', 'Unknown')}\n"
    
        # Format referenced posts
        refs_section = ""
        refs = post.get("referenced_posts", [])
        if refs:
            refs_section = "\nReferenced Posts:\n"
            for ref in refs:
                ref_text = ref.get("text", "No text")
                if ref_text:
                    ref_text = ref_text.replace("\\n", "\n")
                ref_author_id = ref.get("author_id", "Unknown")
                refs_section += f"- Reference: {ref.get('reference', 'Unknown')}\n"
                refs_section += f"  Author ID: {ref_author_id}\n"
                refs_section += f"  Text: {ref_text}\n"
    
        # Assemble the formatted post
        formatted = f"""
    Post ID: {post_id}
    Author: {author} (ID: {author_id}, tripcode: {tripcode})
    Source: {board} on {site}
    Date: {date_str}
    Text:
    {text}
    {images_section}
    {refs_section}
    """
        return formatted.strip()
  • Input schema defined in the tool's docstring, describing parameters start_date (str, required), end_date (str, optional), limit (int, optional=10). Output is str.
    """
    Get posts/drops within a specific date range.
    
    Args:
        start_date: Start date in YYYY-MM-DD format
        end_date: End date in YYYY-MM-DD format (defaults to start_date if not provided)
        limit: Maximum number of results to return (default: 10)
    """
  • The @mcp.tool() decorator registers this function as an MCP tool named 'get_posts_by_date'.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool retrieves posts/drops but doesn't specify what 'posts/drops' are, whether results are paginated, sorted, or include metadata, or if there are rate limits or authentication requirements. For a read operation with 3 parameters and no annotation coverage, this leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by a bullet-point list of parameters with essential details. Each sentence earns its place by providing critical information without redundancy. It's front-loaded with the main function and appropriately sized for a tool with 3 parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no annotations, no output schema), the description is partially complete. It excels in parameter semantics but lacks behavioral context like result format, error handling, or sibling differentiation. Without an output schema, it should ideally describe return values, but it doesn't, leaving gaps in overall completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds substantial meaning beyond the input schema, which has 0% description coverage. It explains that start_date and end_date are in YYYY-MM-DD format, clarifies that end_date defaults to start_date if not provided, and specifies that limit defaults to 10 with a maximum number of results. This compensates fully for the schema's lack of descriptions, making parameter usage clear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get posts/drops within a specific date range.' It specifies the verb ('Get') and resource ('posts/drops'), and the date range qualification distinguishes it from siblings like get_posts_by_author_id or search_posts. However, it doesn't explicitly differentiate from word_cloud_by_date_range, which also uses date ranges but for a different purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention siblings like get_posts_by_author_id for author-based filtering, search_posts for keyword searches, or word_cloud_by_date_range for analytics. The only implied usage is for date-based retrieval, but no explicit comparisons or exclusions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jkingsman/qanon-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server