Skip to main content
Glama
rafteles2016

MCP Dynamics CRM Server

by rafteles2016

dynamics_system_health

Monitor system performance and health metrics for Dynamics CRM, providing consolidated telemetry views to identify issues and optimize workflows.

Instructions

Painel de saúde geral do sistema - visão consolidada de performance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeRangeNoPeríodo de tempo para análise24h

Implementation Reference

  • The handler for dynamics_system_health, which collects metrics on failed jobs, slow plugins, active workflows, and recent errors, calculates a health score, and generates a status summary.
    server.tool(
      "dynamics_system_health",
      "Painel de saúde geral do sistema - visão consolidada de performance",
      GetSystemPerformanceSchema.shape,
      async (_params: z.infer<typeof GetSystemPerformanceSchema>) => {
        // Gather multiple data points in parallel
        const [failedJobs, slowPlugins, activeWorkflows, recentErrors] = await Promise.all([
          client.list("asyncoperations", {
            select: ["name", "statuscode", "createdon"],
            filter: "statuscode eq 31",
            orderby: "createdon desc",
            top: 10,
          }),
          client.list("plugintracelogs", {
            select: ["typename", "performanceexecutionduration", "exceptiondetails"],
            filter: "performanceexecutionduration ge 2000",
            orderby: "performanceexecutionduration desc",
            top: 10,
          }),
          client.list("workflows", {
            select: ["name", "category", "statecode"],
            filter: "statecode eq 1",
          }),
          client.list("plugintracelogs", {
            select: ["typename", "messagename", "exceptiondetails", "createdon"],
            filter: "exceptiondetails ne null",
            orderby: "createdon desc",
            top: 10,
          }),
        ]);
    
        const failedJobsList = failedJobs.value as Array<Record<string, unknown>>;
        const slowPluginsList = slowPlugins.value as Array<Record<string, unknown>>;
        const activeWfList = activeWorkflows.value as Array<Record<string, unknown>>;
        const errorsList = recentErrors.value as Array<Record<string, unknown>>;
    
        // Calculate health score
        let healthScore = 100;
        if (failedJobsList.length > 5) healthScore -= 20;
        else if (failedJobsList.length > 0) healthScore -= failedJobsList.length * 3;
        if (slowPluginsList.length > 5) healthScore -= 20;
        else if (slowPluginsList.length > 0) healthScore -= slowPluginsList.length * 3;
        if (errorsList.length > 5) healthScore -= 15;
        healthScore = Math.max(0, healthScore);
    
        const healthStatus = healthScore >= 80 ? "SAUDAVEL" : healthScore >= 50 ? "ATENCAO" : "CRITICO";
    
        return {
          content: [
            {
              type: "text" as const,
              text: `## Saúde do Sistema Dynamics CRM\n\n**Score: ${healthScore}/100 - ${healthStatus}**\n\n---\n\n### Jobs com Falha: ${failedJobsList.length}\n${failedJobsList.slice(0, 5).map((j) => `- ${j.name} (${j.createdon})`).join("\n") || "Nenhum"}\n\n### Plugins Lentos (>2s): ${slowPluginsList.length}\n${slowPluginsList.slice(0, 5).map((p) => `- ${p.typename}: ${p.performanceexecutionduration}ms`).join("\n") || "Nenhum"}\n\n### Workflows Ativos: ${activeWfList.length}\n\n### Erros Recentes de Plugin: ${errorsList.length}\n${errorsList.slice(0, 5).map((e) => `- ${e.typename} (${e.messagename}): ${String(e.exceptiondetails).substring(0, 100)}...`).join("\n") || "Nenhum"}\n\n---\n**Recomendações:**\n${healthScore < 80 ? [
                failedJobsList.length > 0 ? "- Investigar jobs com falha e corrigir as causas" : "",
                slowPluginsList.length > 0 ? "- Otimizar plugins lentos ou convertê-los para assíncrono" : "",
                errorsList.length > 0 ? "- Corrigir erros nos plugins identificados" : "",
              ].filter(Boolean).join("\n") : "Sistema operando normalmente."}`,
            },
          ],
        };
      }
    );
  • The schema used for input validation of the dynamics_system_health tool.
    export const GetSystemPerformanceSchema = z.object({
      timeRange: z.enum(["1h", "6h", "24h", "7d", "30d"]).default("24h")
        .describe("Período de tempo para análise"),
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions 'consolidated view of performance' but doesn't disclose what data is returned, whether it's real-time or historical, authentication requirements, rate limits, or potential system impact. For a system health tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Portuguese that communicates the core purpose. It's appropriately brief for a tool with only one parameter, though it could be more specific about what 'health' encompasses.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a system health monitoring tool with no annotations and no output schema, the description is insufficient. It doesn't explain what metrics are included in the 'consolidated view,' what format the output takes, or how this differs from other system monitoring tools in the sibling list. The agent would struggle to understand what to expect from this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents the single 'timeRange' parameter with its enum values and default. The description adds no additional parameter information beyond what's in the schema, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool provides a 'consolidated view of system performance' which gives a general purpose, but it's vague about what specific metrics or aspects of health are included. It doesn't clearly distinguish this from sibling tools like 'dynamics_get_active_processes' or 'dynamics_get_system_jobs' which might also provide system status information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With many sibling tools that could provide system information (e.g., dynamics_get_active_processes, dynamics_get_system_jobs, dynamics_get_plugin_performance), the description offers no context about when this consolidated view is preferable to more specific tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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