Skip to main content
Glama

get_user_info

Retrieve detailed user information from Dev.to by providing a specific username using the MCP server to access and interact with Dev.to content.

Instructions

Get information about a Dev.to user Args: username: The username of the user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes

Implementation Reference

  • The main handler function for the 'get_user_info' tool. It fetches user information from the Dev.to API endpoint `/users/{username}` using the `fetch_from_api` helper, formats the response using `format_user_profile`, and handles 404 errors by returning a user not found message.
    async def get_user_info(username: str) -> str: """ Get information about a Dev.to user Args: username: The username of the user """ try: user = await fetch_from_api(f"/users/{username}") return format_user_profile(user) except httpx.HTTPStatusError as e: if e.response.status_code == 404: return f"User {username} not found." raise e
  • server.py:89-89 (registration)
    The @mcp.tool() decorator registers the `get_user_info` function as an MCP tool.
    @mcp.tool()
  • The function signature defines the input schema (username: str) and the docstring provides the tool description and parameter details for MCP schema generation.
    async def get_user_info(username: str) -> str: """ Get information about a Dev.to user Args: username: The username of the user """
  • Helper function to format the user profile data retrieved from the API into a human-readable markdown string, used by the get_user_info handler.
    def format_user_profile(user: dict) -> str: """Format a user profile for display""" if not user: return "User not found." username = user.get("username", "Unknown") name = user.get("name", "Unknown") bio = user.get("summary", "No bio available.") twitter = user.get("twitter_username", "") github = user.get("github_username", "") website = user.get("website_url", "") location = user.get("location", "") joined = user.get("joined_at", "") result = f"# {name} (@{username})\n\n" result += f"Bio: {bio}\n\n" result += "## Details\n" if location: result += f"Location: {location}\n" if joined: result += f"Member since: {joined}\n" result += "\n## Links\n" if twitter: result += f"Twitter: @{twitter}\n" if github: result += f"GitHub: {github}\n" if website: result += f"Website: {website}\n" return result
  • Shared helper function to make authenticated GET requests to the Dev.to API, used by get_user_info and other tools.
    async def fetch_from_api(path: str, params: dict = None) -> dict: """Helper function to fetch data from Dev.to API""" async with httpx.AsyncClient() as client: url = f"{BASE_URL}{path}" response = await client.get(url, params=params, timeout=10.0) response.raise_for_status() return response.json()

Other Tools

Related 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/Arindam200/devto-mcp'

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