Skip to main content
Glama
aserper

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

by aserper

npm_metadata

Retrieve npm package metadata including version, documentation URLs, repository links, license, and maintainer information for informed development decisions.

Instructions

Get npm package metadata (name, version, URLs, maintainers). USE THIS WHEN: You need basic package info, version numbers, or links to external documentation. RETURNS: Package metadata ONLY - does NOT include actual documentation content. For full documentation, use fetch_npm_docs instead. The response includes: - Package name, version, description - Documentation URL (docs_url/homepage) - can be passed to WebFetch for external docs - Repository URL (usually GitHub) - License, keywords, maintainers Args: package: npm package name (e.g., "express", "react", "lodash") Example: npm_metadata("express") → Returns metadata with links to expressjs.com

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageYes

Implementation Reference

  • The main handler function for the npm_metadata tool. It fetches package metadata using _fetch_metadata and serializes the response.
    async def npm_metadata(package: str) -> CallToolResult: """ Get npm package metadata (name, version, URLs, maintainers). USE THIS WHEN: You need basic package info, version numbers, or links to external documentation. RETURNS: Package metadata ONLY - does NOT include actual documentation content. For full documentation, use fetch_npm_docs instead. The response includes: - Package name, version, description - Documentation URL (docs_url/homepage) - can be passed to WebFetch for external docs - Repository URL (usually GitHub) - License, keywords, maintainers Args: package: npm package name (e.g., "express", "react", "lodash") Example: npm_metadata("express") → Returns metadata with links to expressjs.com """ result = await self._fetch_metadata(package) return serialize_response_with_meta(result)
  • The get_tools method registers the npm_metadata function as a tool in the provider's tools dictionary.
    def get_tools(self) -> dict[str, Callable]: """Return MCP tool functions.""" async def npm_metadata(package: str) -> CallToolResult: """ Get npm package metadata (name, version, URLs, maintainers). USE THIS WHEN: You need basic package info, version numbers, or links to external documentation. RETURNS: Package metadata ONLY - does NOT include actual documentation content. For full documentation, use fetch_npm_docs instead. The response includes: - Package name, version, description - Documentation URL (docs_url/homepage) - can be passed to WebFetch for external docs - Repository URL (usually GitHub) - License, keywords, maintainers Args: package: npm package name (e.g., "express", "react", "lodash") Example: npm_metadata("express") → Returns metadata with links to expressjs.com """ result = await self._fetch_metadata(package) return serialize_response_with_meta(result) async def fetch_npm_docs(package: str, max_bytes: int = 20480) -> CallToolResult: """ Fetch actual npm package documentation from npm registry README. USE THIS WHEN: You need installation instructions, usage examples, API reference, or quickstart guides. BEST FOR: Getting complete, formatted documentation for JavaScript/Node.js packages. Better than using curl or WebFetch because it: - Automatically extracts relevant sections (Installation, Usage, Examples, API) - Prioritizes most useful content sections - Already in Markdown format (npm requires Markdown READMEs) NOT SUITABLE FOR: External documentation sites (use docs_url from npm_metadata + WebFetch) Args: package: npm package name (e.g., "express", "react", "axios") max_bytes: Maximum content size, default 20KB (increase for large packages) Returns: JSON with actual documentation content, size, truncation status, version Example: fetch_npm_docs("express") → Returns formatted README with installation and usage """ result = await self._fetch_npm_docs(package, max_bytes) return serialize_response_with_meta(result) tools = {"npm_metadata": npm_metadata} if is_fetch_enabled(): tools["fetch_npm_docs"] = fetch_npm_docs return tools
  • The get_metadata method declares 'npm_metadata' in the list of tool_names for the provider.
    def get_metadata(self) -> ProviderMetadata: tool_names = ["npm_metadata"] if is_fetch_enabled(): tool_names.append("fetch_npm_docs") return ProviderMetadata( name="npm", description="npm package registry metadata and documentation", expose_as_tool=True, tool_names=tool_names, supports_library_search=True, required_env_vars=[], optional_env_vars=[], )
  • Helper function that fetches and processes raw metadata from the npm registry API, extracting key fields like repository, docs_url, maintainers.
    async def _fetch_metadata(self, package: str) -> dict[str, Any]: """Pull package metadata from the npm registry JSON API.""" url = f"https://registry.npmjs.org/{package}" async with await self._http_client() as client: resp = await client.get(url) resp.raise_for_status() payload = resp.json() # Extract repository URL repo_url = None repository = payload.get("repository") if isinstance(repository, dict): repo_url = repository.get("url") elif isinstance(repository, str): repo_url = repository # Clean up repository URL (remove git+ prefix and .git suffix if present) if repo_url: if repo_url.startswith("git+"): repo_url = repo_url[4:] if repo_url.endswith(".git"): repo_url = repo_url[:-4] # Extract documentation URL from links object or use homepage docs_url = payload.get("homepage") # Extract maintainers maintainers = [] for maintainer in payload.get("maintainers", []): if isinstance(maintainer, dict): maintainers.append( { "name": maintainer.get("name"), "email": maintainer.get("email"), } ) return { "name": payload.get("name"), "summary": payload.get("description") or "", "version": payload.get("version"), "home_page": payload.get("homepage"), "docs_url": docs_url, "repository": repo_url, "license": payload.get("license"), "keywords": payload.get("keywords", []), "maintainers": maintainers, "author": payload.get("author"), "readme": payload.get("readme", ""), # Include README for fetch_npm_docs }

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