Skip to main content
Glama

get_summary

Extract concise summaries from Wikipedia articles to quickly understand key information without reading full pages. Provide the article title to receive a structured summary with title and content.

Instructions

Get a summary of a Wikipedia article.

Returns a dictionary with the title and summary string. On error, includes an error message instead of a summary.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes

Implementation Reference

  • MCP tool handler and registration for 'get_summary'. Delegates to WikipediaClient.get_summary and formats response as dict with title and summary or error.
    @server.tool() def get_summary(title: str) -> Dict[str, Any]: """ Get a summary of a Wikipedia article. Returns a dictionary with the title and summary string. On error, includes an error message instead of a summary. """ logger.info(f"Tool: Getting summary for: {title}") summary = wikipedia_client.get_summary(title) if summary and not summary.startswith("Error"): return {"title": title, "summary": summary} else: return {"title": title, "summary": None, "error": summary}
  • Core implementation of get_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)}"
  • Optional LRU caching applied to get_summary method when enable_cache=True.
    self.get_summary = functools.lru_cache(maxsize=128)(self.get_summary)

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