Skip to main content
Glama

get_summary

Read-onlyIdempotent

Retrieve a concise summary and title of any Wikipedia article by providing its title.

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
summaryNo
errorNo

Implementation Reference

  • The main handler function for the 'get_summary' tool. Decorated with @register_tool, it takes a title string, calls wikipedia_client.get_summary(), and returns a dictionary with title/summary/error.
    @register_tool("get_summary", model_output_schema(SummaryResponse))
    def get_summary(title: str):
        """
        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("Tool: Getting summary for: %s", title)
        summary = wikipedia_client.get_summary(title)
        if summary and not summary.startswith("Error"):
            return {"title": title, "summary": summary}
        return {"title": title, "summary": None, "error": summary}
  • The low-level Wikipedia API call that fetches the summary using the wikipedia library (page.summary). Handles errors and non-existent pages.
    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)}"
  • The SummaryResponse Pydantic model defining the output schema for the get_summary tool: title (str), summary (Optional[str]), error (Optional[str]).
    class SummaryResponse(MCPBaseModel):
        title: str
        summary: Optional[str] = None
        error: Optional[str] = None
  • The register_tool decorator that registers the function under the name 'get_summary' (and also 'wikipedia_get_summary') with the MCP server, using the SummaryResponse output schema.
    def register_tool(name: str, output_schema: dict[str, Any]):
        def decorator(func):
            server.tool(
                func,
                name=name,
                annotations=_READ_ONLY_TOOL_ANNOTATIONS,
                output_schema=output_schema,
            )
            server.tool(
                func,
                name=f"wikipedia_{name}",
                annotations=_READ_ONLY_TOOL_ANNOTATIONS,
                output_schema=output_schema,
            )
            return func
  • Caching: get_summary is wrapped with lru_cache for performance when caching is enabled.
    self.get_summary = functools.lru_cache(maxsize=128)(self.get_summary)  # type: ignore[method-assign]
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and openWorldHint, covering safety. Description adds error behavior context ('On error, includes an error message'), which provides additional transparency beyond annotations.

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?

Two sentences, no redundant information. First sentence states purpose, second explains return structure and error handling. Efficient and front-loaded.

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

Completeness5/5

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

Given the simple input (one string parameter) and presence of output schema, the description sufficiently covers purpose, return format, and error case. Annotations provide additional safety context.

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

Parameters2/5

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

Input schema has 0% description coverage. Description does not explain the 'title' parameter beyond implying it's the article's title. No details on formatting, case sensitivity, or validation rules.

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?

Description clearly states action ('Get a summary') and resource ('Wikipedia article'). It distinguishes from siblings like 'get_article' by specifying a summary, but does not differentiate from other summary tools like 'summarize_article_for_query'.

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?

No explicit guidance on when to use this tool vs. alternatives. Does not mention when not to use it or suggest other tools for different contexts.

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

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