Skip to main content
Glama

get_summary

Retrieve concise summaries of Wikipedia articles by specifying the article title. Ideal for quick insights or extracting key information from Wikipedia content efficiently.

Instructions

Get a summary of a Wikipedia article.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes

Implementation Reference

  • Handler function for the 'get_summary' tool, registered with @server.tool(). It takes a title, fetches the summary from WikipediaClient, and returns a structured dictionary.
    @server.tool() def get_summary(title: str) -> Dict[str, Any]: """Get a summary of a Wikipedia article.""" logger.info(f"Tool: Getting summary for: {title}") summary = wikipedia_client.get_summary(title) return {"title": title, "summary": summary}
  • Core helper method in WikipediaClient that retrieves the summary using wikipediaapi.Wikipedia.page(title).summary, with error handling.
    def get_summary(self, title: str) -> str: """Get a summary of a Wikipedia article. Args: title: The title of the Wikipedia article. Returns: The article summary. """ try: page = self.wiki.page(title) if not page.exists(): return f"No Wikipedia article found for '{title}'." return page.summary except Exception as e: logger.error(f"Error getting Wikipedia summary: {e}") return f"Error retrieving summary for '{title}': {str(e)}"
  • Caching configuration in WikipediaClient.__init__ that applies functools.lru_cache to get_summary and other methods when enable_cache is True.
    if self.enable_cache: self.search = functools.lru_cache(maxsize=128)(self.search) self.get_article = functools.lru_cache(maxsize=128)(self.get_article) self.get_summary = functools.lru_cache(maxsize=128)(self.get_summary) self.get_sections = functools.lru_cache(maxsize=128)(self.get_sections) self.get_links = functools.lru_cache(maxsize=128)(self.get_links) self.get_related_topics = functools.lru_cache(maxsize=128)(self.get_related_topics) self.summarize_for_query = functools.lru_cache(maxsize=128)(self.summarize_for_query) self.summarize_section = functools.lru_cache(maxsize=128)(self.summarize_section) self.extract_facts = functools.lru_cache(maxsize=128)(self.extract_facts) self.get_coordinates = functools.lru_cache(maxsize=128)(self.get_coordinates)
  • Registration of the 'get_summary' tool using the @server.tool() decorator in the FastMCP server setup.
    @server.tool() def get_summary(title: str) -> Dict[str, Any]: """Get a summary of a Wikipedia article.""" logger.info(f"Tool: Getting summary for: {title}") summary = wikipedia_client.get_summary(title) return {"title": title, "summary": summary}

Other Tools

Related 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/Rudra-ravi/wikipedia-mcp'

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