Skip to main content
Glama
dev484p

Agentic AI with MCP

by dev484p

wiki_search

Search Wikipedia articles to find information and answers for research or general knowledge queries, returning relevant results based on your search terms.

Instructions

Search Wikipedia for articles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Implementation Reference

  • server.py:60-88 (handler)
    The main handler function for the 'wiki_search' tool. It uses the Wikipedia API to search for articles matching the query, up to the specified limit, and returns formatted results with titles, summaries, and URLs. Includes error handling.
    @mcp.tool()
    async def wiki_search(query: str, limit: int = 3) -> str:
        """Search Wikipedia for articles."""
        try:
            params = {
                "action": "query",
                "list": "search",
                "srsearch": query,
                "format": "json",
                "srlimit": limit
            }
            
            data = await make_api_request(WIKI_API_BASE, params=params)
            
            if not data or "query" not in data or not data["query"]["search"]:
                return "No Wikipedia articles found for your query."
            
            results = []
            for item in data["query"]["search"]:
                title = item["title"]
                snippet = item["snippet"].replace("<span class=\"searchmatch\">", "").replace("</span>", "")
                url = f"https://en.wikipedia.org/wiki/{urllib.parse.quote(title.replace(' ', '_'))}"
                results.append(f"Title: {title}\nSummary: {snippet}\nURL: {url}")
            
            return "\n\n".join(results)
        except Exception as e:
            logger.error(f"Error in wiki_search: {e}")
            return "Failed to search Wikipedia due to an internal error."
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a search operation but doesn't describe what the search returns (e.g., article summaries, links), whether it has rate limits, authentication needs, or any constraints like language or date ranges. 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 a single, efficient sentence with no wasted words, making it easy to parse. It's front-loaded with the core action and resource, though it could benefit from additional context to improve usefulness without sacrificing brevity.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't address the tool's complexity (a search operation with parameters), leaving the agent unsure about return values, error handling, or how results are structured. For a tool with 2 parameters and no structured output, more detail is needed to be fully helpful.

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

Parameters3/5

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

The schema description coverage is 0%, so the description must compensate, but it adds no information about parameters. It doesn't explain what 'query' should contain or that 'limit' controls the number of results, leaving both parameters undocumented beyond their schema definitions. However, with only 2 parameters and a default for 'limit', the baseline is slightly higher.

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 action ('Search') and resource ('Wikipedia for articles'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'internet_search' or 'yahoo_finance_search', which would require mentioning Wikipedia specifically as the search target versus broader internet or finance searches.

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 that it's for Wikipedia-specific searches as opposed to general internet searches or finance-related searches, nor does it specify any prerequisites or exclusions for usage.

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/dev484p/AgenticAI_MCP'

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