Skip to main content
Glama
rafteles2016

MCP Dynamics CRM Server

by rafteles2016

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
NameRequiredDescriptionDefault
processTypeNoall
stateFilterNoactive

Implementation Reference

  • 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)}`,
            },
          ],
        };
      }
    );
  • 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"),
    });
  • The registration of the 'dynamics_get_active_processes' tool via server.tool.
    "dynamics_get_active_processes",

Latest Blog Posts

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/rafteles2016/mcpDynamics'

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