dynamics_get_active_processes
Lists active workflows, actions, and business processes in Dynamics CRM with their current statuses to monitor system operations.
Instructions
Lista processos ativos (workflows, actions, BPFs) e seus estados
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| processType | No | all | |
| stateFilter | No | active |
Implementation Reference
- src/tools/telemetry/index.ts:188-238 (handler)The handler implementation for 'dynamics_get_active_processes', which constructs filter queries, retrieves workflow data from the client, and formats the output.
server.tool( "dynamics_get_active_processes", "Lista processos ativos (workflows, actions, BPFs) e seus estados", GetActiveProcessesSchema.shape, async (params: z.infer<typeof GetActiveProcessesSchema>) => { const filters: string[] = []; const typeMap: Record<string, number> = { workflow: 0, action: 1, businessprocessflow: 2, dialog: 3, }; if (params.processType !== "all") { filters.push(`category eq ${typeMap[params.processType]}`); } if (params.stateFilter === "active") { filters.push("statecode eq 1"); } else if (params.stateFilter === "inactive") { filters.push("statecode eq 0"); } const result = await client.list("workflows", { select: [ "workflowid", "name", "category", "type", "statecode", "statuscode", "primaryentity", "mode", "scope", "ondemand", "triggeroncreate", "triggeronupdateattributelist", "triggerondelete", "createdon", "modifiedon", ], filter: filters.length > 0 ? filters.join(" and ") : undefined, orderby: "name asc", }); const processes = result.value as Array<Record<string, unknown>>; const categorySummary: Record<string, number> = {}; const categoryNames: Record<number, string> = { 0: "Workflow", 1: "Action", 2: "Business Process Flow", 3: "Dialog" }; for (const proc of processes) { const catName = categoryNames[proc.category as number] || "Outro"; categorySummary[catName] = (categorySummary[catName] || 0) + 1; } return { content: [ { type: "text" as const, text: `## Processos Ativos\n\n**Resumo por Categoria:**\n${Object.entries(categorySummary).map(([cat, count]) => `- ${cat}: ${count}`).join("\n")}\n\n**Total:** ${processes.length}\n\n**Detalhes:**\n${JSON.stringify(processes.slice(0, 20), null, 2)}`, }, ], }; } ); - src/tools/telemetry/index.ts:27-30 (schema)The Zod schema definition for 'dynamics_get_active_processes' inputs.
export const GetActiveProcessesSchema = z.object({ processType: z.enum(["all", "workflow", "action", "businessprocessflow", "dialog"]).default("all"), stateFilter: z.enum(["all", "active", "inactive"]).default("active"), }); - src/tools/telemetry/index.ts:189-189 (registration)The registration of the 'dynamics_get_active_processes' tool via server.tool.
"dynamics_get_active_processes",