docs
Retrieve documentation URLs for npm packages to access installation guides, API references, and usage examples.
Instructions
Get the documentation URL for a package
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package | Yes | Package name |
Implementation Reference
- src/index.ts:640-659 (handler)The "docs" tool handler implementation, which runs `npm docs <package> --no-browser` and returns the output.
// ── npm docs ── server.tool( "docs", "Get the documentation URL for a package", { package: z.string().describe("Package name"), }, async ({ package: pkg }) => { const args = ["docs", pkg, "--no-browser"]; try { const { stdout, stderr } = await run(args); return { content: [{ type: "text", text: (stdout + stderr).trim() }] }; } catch (e: any) { return { content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }], isError: true, }; } }, );