Skip to main content
Glama

mcp-google-sheets

run-robot.ts1.79 kB
import { HttpMethod } from '@activepieces/pieces-common'; import { createAction, Property } from '@activepieces/pieces-framework'; import { browseAiApiCall } from '../common/client'; import { browseAiAuth } from '../common/auth'; import { robotIdDropdown, robotParameters } from '../common/props'; export const runRobotAction = createAction({ name: 'run-robot', auth: browseAiAuth, displayName: 'Run a Robot', description: 'Runs a robot on-demand with custom input parameters.', props: { robotId: robotIdDropdown, recordVideo: Property.Checkbox({ displayName: 'Record Video', description: 'Try to record a video while running the task.', required: false, defaultValue: false, }), robotParams: robotParameters, }, async run(context) { const { robotId, recordVideo } = context.propsValue; const inputParameters = context.propsValue.robotParams ?? {}; try { const response = await browseAiApiCall({ method: HttpMethod.POST, resourceUri: `/robots/${robotId}/tasks`, auth: { apiKey: context.auth as string }, body: { recordVideo: recordVideo || false, inputParameters, }, }); return response; } catch (error: any) { if (error.response?.status === 401) { throw new Error('Authentication failed. Please check your API key.'); } if (error.response?.status === 404) { throw new Error('Robot not found. Please verify the robot ID.'); } if (error.response?.status === 429) { throw new Error('Rate limit exceeded. Please wait before retrying.'); } throw new Error( `Failed to run robot: ${error.message || 'Unknown error occurred'}` ); } }, });

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/activepieces/activepieces'

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