Skip to main content
Glama
martinfrasch

ResearchTwin

get_network_map

Map researcher geographic distribution by retrieving institutional affiliations and coordinates from ORCID and Semantic Scholar to visualize network locations.

Instructions

Get geographic affiliations for all researchers in the network.

Returns researchers with their institutional affiliations and coordinates, sourced from ORCID and Semantic Scholar. Useful for understanding the geographic distribution of the research network.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that implements get_network_map tool logic. It calls the /api/network/map endpoint, processes researcher affiliation data, and returns a formatted string with geographic information for all researchers in the network.
    async def get_network_map() -> str:
        """Get geographic affiliations for all researchers in the network.
    
        Returns researchers with their institutional affiliations and coordinates,
        sourced from ORCID and Semantic Scholar. Useful for understanding the
        geographic distribution of the research network.
        """
        data = await _get("/api/network/map")
        researchers = data.get("researchers", [])
        if not researchers:
            return "No affiliation data available yet."
    
        lines = []
        for r in researchers:
            affs = r.get("affiliations", [])
            aff_strs = []
            for a in affs:
                loc = [a.get("city"), a.get("country")]
                loc_str = ", ".join(x for x in loc if x)
                status = "current" if a.get("current") else "past"
                aff_strs.append(f"  - {a['institution']}" + (f" ({loc_str})" if loc_str else "") + f" [{status}]")
            lines.append(f"**{r['name']}** (`{r['slug']}`):\n" + "\n".join(aff_strs))
    
        return f"**Network map — {data.get('total_researchers', len(researchers))} researchers:**\n\n" + "\n\n".join(lines)
  • The @mcp.tool decorator that registers get_network_map as an MCP tool with metadata including title 'Get Network Map' and read_only_hint=True.
    @mcp.tool(annotations=ToolAnnotations(title="Get Network Map", read_only_hint=True))
  • The _get() helper utility function that makes async HTTP GET requests to the ResearchTwin API, used by get_network_map to fetch data from /api/network/map endpoint.
    async def _get(path: str, params: dict | None = None) -> dict:
        """Make a GET request to the ResearchTwin API."""
        async with httpx.AsyncClient(timeout=TIMEOUT) as client:
            resp = await client.get(f"{BASE_URL}{path}", params=params)
            resp.raise_for_status()
            return resp.json()
  • Import of ToolAnnotations from mcp.types, which provides the schema/metadata structure for tool definitions (used in the decorator at line 214).
    from mcp.types import ToolAnnotations

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/martinfrasch/researchtwin'

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