Skip to main content
Glama

get_links

Extract all hyperlinks from a Wikipedia article to identify related topics and references for research or content analysis.

Instructions

Get the links contained within a Wikipedia article.

Returns a dictionary with the article title and list of links.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes

Implementation Reference

  • MCP tool handler for get_links, decorated with @server.tool() for registration. Takes article title as input, calls WikipediaClient.get_links, and returns dict with title and list of links.
    @server.tool() def get_links(title: str) -> Dict[str, Any]: """ Get the links contained within a Wikipedia article. Returns a dictionary with the article title and list of links. """ logger.info(f"Tool: Getting links for: {title}") links = wikipedia_client.get_links(title) return {"title": title, "links": links}
  • Core helper method in WikipediaClient that implements get_links by fetching the Wikipedia page via wikipediaapi.Wikipedia.page() and extracting page.links.keys() as list of link titles.
    def get_links(self, title: str) -> List[str]: """ Get the links in a Wikipedia article. Args: title: The title of the Wikipedia article. Returns: A list of links. """ try: page = self.wiki.page(title) if not page.exists(): return [] return [link for link in page.links.keys()] except Exception as e: logger.error(f"Error getting Wikipedia links: {e}") return []
  • The @server.tool() decorator registers the get_links function as an MCP tool.
    @server.tool()
  • Type hints and docstring define the input schema (title: str) and output schema (Dict[str, Any] with title and links).
    def get_links(title: str) -> Dict[str, Any]: """ Get the links contained within a Wikipedia article. Returns a dictionary with the article title and list of links. """

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