profile
View or update npm user profile settings like email, full name, or homepage using get or set actions.
Instructions
View or modify npm user profile settings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform | |
| field | No | Profile field to get or set (e.g. email, fullname, homepage) | |
| value | No | Value to set (required for set action) | |
| otp | No | One-time password for 2FA |
Implementation Reference
- src/index.ts:816-841 (handler)The implementation of the 'profile' tool, which allows viewing or modifying npm user profile settings by executing 'npm profile' commands.
server.tool( "profile", "View or modify npm user profile settings", { action: z.enum(["get", "set"]).describe("Action to perform"), field: z.string().optional().describe("Profile field to get or set (e.g. email, fullname, homepage)"), value: z.string().optional().describe("Value to set (required for set action)"), otp: z.string().optional().describe("One-time password for 2FA"), }, async ({ action, field, value, otp }) => { const args = ["profile", action]; if (field) args.push(field); if (action === "set" && value) args.push(value); if (action === "get") args.push("--json"); if (otp) args.push("--otp", otp); 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, }; } }, );