Skip to main content
Glama

view

Retrieve npm package details like versions and distribution tags directly from the registry to inspect dependencies and metadata.

Instructions

View package information from the registry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageYesPackage name (e.g. react, @scope/pkg)
fieldNoSpecific field to view (e.g. versions, dist-tags)

Implementation Reference

  • The implementation of the 'view' tool handler, which executes 'npm view' using the provided package name and optional field.
    server.tool(
      "view",
      "View package information from the registry",
      {
        package: z.string().describe("Package name (e.g. react, @scope/pkg)"),
        field: z.string().optional().describe("Specific field to view (e.g. versions, dist-tags)"),
      },
      async ({ package: pkg, field }) => {
        const args = ["view", pkg];
        if (field) args.push(field);
        args.push("--json");
        try {
          const { stdout } = await run(args);
          return { content: [{ type: "text", text: stdout }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );

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/mikusnuz/npm-mcp'

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