Skip to main content
Glama
VectorInstitute

MCP Goodnews

fetch_list_of_goodnews

Retrieve positive news headlines filtered by category, using sentiment analysis to identify uplifting stories from NewsAPI.

Instructions

Fetch a list of headlines and return only top-ranked news based on positivity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoall

Implementation Reference

  • The `fetch_list_of_goodnews` tool handler which fetches headlines based on categories and then uses `GoodnewsRanker` to filter for positive news.
    @mcp.tool()
    async def fetch_list_of_goodnews(
        category: Literal["all", "science", "health", "technology"] = "all",
    ) -> str:
        """Fetch a list of headlines and return only top-ranked news based on positivity."""
    
        # make request to top-headlines newsapi
        articles = []
        if category == "all":
            categories = ["science", "health", "technology"]
        else:
            categories = [category]
        for cat in categories:
            top_articles = await get_top_headlines(cat)
            articles.extend(top_articles)
    
        # rank the retrieved handlines and get only most positive articles
        ranker = GoodnewsRanker(model_name="command-a-03-2025")
        goodnews = await ranker.rank_articles(articles)
    
        return goodnews  # type: ignore[no-any-return]
  • Tool registration using the `@mcp.tool()` decorator in the `FastMCP` server instance.
    @mcp.tool()
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/VectorInstitute/mcp-goodnews'

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