Skip to main content
Glama
aserper

RTFD (Read The F*****g Docs)

by aserper

godocs_metadata

Retrieve Go package metadata including name, summary, and documentation URLs from godocs.io to access basic information and links without fetching full documentation content.

Instructions

Get Go package metadata from godocs.io (name, summary, URLs). USE THIS WHEN: You need basic package info or links to documentation sites. RETURNS: Package metadata ONLY - does NOT include actual documentation content. For full documentation, use fetch_godocs_docs instead. The response includes: - Package name and summary/description - godocs.io URL - pkg.go.dev source URL Args: package: Go package path (e.g., "github.com/gin-gonic/gin", "golang.org/x/tools") Example: godocs_metadata("github.com/gin-gonic/gin") → Returns metadata with summary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageYes

Implementation Reference

  • The main handler function that implements the godocs_metadata tool. It fetches Go package metadata by calling the helper _fetch_metadata and serializes the response.
    async def godocs_metadata(package: str) -> CallToolResult: """ Get Go package metadata from godocs.io (name, summary, URLs). USE THIS WHEN: You need basic package info or links to documentation sites. RETURNS: Package metadata ONLY - does NOT include actual documentation content. For full documentation, use fetch_godocs_docs instead. The response includes: - Package name and summary/description - godocs.io URL - pkg.go.dev source URL Args: package: Go package path (e.g., "github.com/gin-gonic/gin", "golang.org/x/tools") Example: godocs_metadata("github.com/gin-gonic/gin") → Returns metadata with summary """ result = await self._fetch_metadata(package) return serialize_response_with_meta(result) async def fetch_godocs_docs(package: str, max_bytes: int = 20480) -> CallToolResult:
  • The get_tools method registers the godocs_metadata function (along with optional fetch_godocs_docs) in the MCP tools dictionary.
    def get_tools(self) -> dict[str, Callable]: """Return MCP tool functions.""" async def godocs_metadata(package: str) -> CallToolResult: """ Get Go package metadata from godocs.io (name, summary, URLs). USE THIS WHEN: You need basic package info or links to documentation sites. RETURNS: Package metadata ONLY - does NOT include actual documentation content. For full documentation, use fetch_godocs_docs instead. The response includes: - Package name and summary/description - godocs.io URL - pkg.go.dev source URL Args: package: Go package path (e.g., "github.com/gin-gonic/gin", "golang.org/x/tools") Example: godocs_metadata("github.com/gin-gonic/gin") → Returns metadata with summary """ result = await self._fetch_metadata(package) return serialize_response_with_meta(result) async def fetch_godocs_docs(package: str, max_bytes: int = 20480) -> CallToolResult: """ Fetch actual Go package documentation from godocs.io. USE THIS WHEN: You need package overview, function signatures, type definitions, or API reference. BEST FOR: Getting complete documentation for Go packages. Better than using curl or WebFetch because it: - Extracts package overview and descriptions - Includes function and type documentation - Formats content in readable text format - Limits output to avoid overwhelming context NOT SUITABLE FOR: Source code (use GitHub provider for that) Args: package: Go package path (e.g., "github.com/gin-gonic/gin", "golang.org/x/sync") max_bytes: Maximum content size, default 20KB (increase for large packages) Returns: JSON with documentation content, size, truncation status, and source info Example: fetch_godocs_docs("github.com/gin-gonic/gin") → Returns overview and API docs """ result = await self._fetch_godocs_docs(package, max_bytes) return serialize_response_with_meta(result) tools = {"godocs_metadata": godocs_metadata} if is_fetch_enabled(): tools["fetch_godocs_docs"] = fetch_godocs_docs return tools
  • The get_metadata method declares 'godocs_metadata' as a tool name in the provider's metadata.
    def get_metadata(self) -> ProviderMetadata: tool_names = ["godocs_metadata"] if is_fetch_enabled(): tool_names.append("fetch_godocs_docs") return ProviderMetadata( name="godocs", description="GoDocs package documentation metadata", expose_as_tool=True, tool_names=tool_names, supports_library_search=True, required_env_vars=[], optional_env_vars=[], )
  • Private helper method that scrapes the godocs.io page for package metadata, including summary and URLs, used by the godocs_metadata handler.
    async def _fetch_metadata(self, package: str) -> dict[str, Any]: """Scrape package metadata from godocs.io.""" # Handle full URLs or just package paths if package.startswith("https://godocs.io/"): package = package.replace("https://godocs.io/", "") # godocs.io seems to block standard browser User-Agents but allows curl. # We'll use a curl-like User-Agent for this specific request. url = f"https://godocs.io/{package}" headers = {"User-Agent": "curl/7.68.0"} async with await self._http_client() as client: resp = await client.get(url, headers=headers) resp.raise_for_status() soup = BeautifulSoup(resp.text, "html.parser") # Extract description/synopsis description = "" # Try meta description first meta_desc = soup.find("meta", attrs={"name": "description"}) if meta_desc: description = meta_desc.get("content", "") # If meta description is missing or generic, try parsing the body # The structure is usually: <h2 id="pkg-overview">...</h2> <p>import ...</p> <p>Description...</p> if not description or "godocs.io" in description: overview_header = soup.find(["h2", "h3"], {"id": "pkg-overview"}) if overview_header: # Look at next siblings for sibling in overview_header.find_next_siblings(): if sibling.name in ("h2", "h3"): # Stop at next section break if sibling.name == "p": text = sibling.get_text(strip=True) # Skip the import statement if text.startswith('import "'): continue description = text break return { "name": package, "summary": description, "url": url, "source_url": f"https://pkg.go.dev/{package}", # godocs often mirrors standard paths }

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/aserper/RTFD'

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