Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.0 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';

import { hackernewsApi } from '../../common/api';
import { hackernewsGetUserOutputSchema } from '../../output-schemas';

export const getUserAction = createAction({
	name: 'hackernews_get_user',
	outputSchema: hackernewsGetUserOutputSchema,
	displayName: 'Get User',
	description: 'Gets a Hacker News user profile by username.',
	audience: 'ai',
	classification: 'READ',
	aiMetadata: {
		description:
			'Fetches a Hacker News user profile: karma, about text, signup date and their most recent submission ids (up to 100, newest first, with the full count). Usernames are case-sensitive and come from the author field of an item. Only users with public activity exist.',
		idempotent: true,
	},
	props: {
		username: Property.ShortText({
			displayName: 'Username',
			description: 'The case-sensitive Hacker News username, e.g. "pg".',
			required: true,
		}),
	},
	async run({ propsValue }) {
		return await hackernewsApi.getUser({ username: propsValue.username });
	},
});