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
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { SeekPage } from '@activepieces/core-utils'
import { FlowsContext, ListFlowsContextParams } from '@activepieces/pieces-framework'
import { FetchError, PopulatedFlow } from '@activepieces/shared'
import { retryFetch } from '../api/retry-fetch'
export const createFlowsContext = ({ engineToken, internalApiUrl, flowId, flowVersionId }: CreateFlowsServiceParams): FlowsContext => {
return {
async list(params: ListFlowsContextParams): Promise<SeekPage<PopulatedFlow>> {
const queryParams = new URLSearchParams()
if (params?.externalIds) {
queryParams.set('externalIds', params.externalIds.join(','))
}
const url = `${internalApiUrl}v1/engine/populated-flows?${queryParams.toString()}`
const response = await retryFetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${engineToken}`,
},
})
if (!response.ok) {
throw new FetchError(url, `status=${response.status}`)
}
return response.json()
},
current: {
id: flowId,
version: {
id: flowVersionId,
},
},
}
}
type CreateFlowsServiceParams = {
engineToken: string
internalApiUrl: string
flowId: string
flowVersionId: string
}