Skip to main content
Glama

mcp-google-sheets

common.ts1.73 kB
import { FlowStatus, FlowTriggerType, isNil, PopulatedFlow } from "@activepieces/shared"; import { FlowsContext, ListFlowsContextParams } from "@activepieces/pieces-framework"; export const callableFlowKey = (runId: string) => `callableFlow_${runId}`; export type CallableFlowRequest = { data: unknown; callbackUrl: string; } export type CallableFlowResponse = { status: 'success' | 'error'; data: unknown; } export const MOCK_CALLBACK_IN_TEST_FLOW_URL = 'MOCK'; export async function listEnabledFlowsWithSubflowTrigger({ flowsContext, params, }: ListParams) { const allFlows = (await flowsContext.list(params)).data; const flows = allFlows.filter( (flow) => flow.status === FlowStatus.ENABLED && flow.version.trigger.type === FlowTriggerType.PIECE && flow.version.trigger.settings.pieceName == '@activepieces/piece-subflows' ); return flows; } export async function findFlowByExternalIdOrThrow({ flowsContext, externalId, }: { flowsContext: FlowsContext; externalId: string | undefined; }): Promise<PopulatedFlow> { if (isNil(externalId)) { throw new Error(JSON.stringify({ message: 'Please select a flow', })); } const externalIds = [externalId]; const allFlows = await listEnabledFlowsWithSubflowTrigger({ flowsContext, params: { externalIds } }); if (allFlows.length === 0) { throw new Error(JSON.stringify({ message: 'Flow not found', externalId, })); } return allFlows[0]; } type ListParams = { flowsContext: FlowsContext, params?: ListFlowsContextParams }

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