Skip to main content
Glama
rafteles2016

MCP Dynamics CRM Server

by rafteles2016

dynamics_get_plugin_performance

Analyze plugin execution performance in Dynamics CRM by tracking duration, errors, and frequency to identify bottlenecks and optimize workflows.

Instructions

Analisa performance de execução de plugins (duração, erros, frequência)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNoNúmero de plugins a retornar
minDurationNoDuração mínima em ms para filtrar
entityLogicalNameNoFiltrar por entidade

Implementation Reference

  • Implementation of the dynamics_get_plugin_performance tool handler.
    server.tool(
      "dynamics_get_plugin_performance",
      "Analisa performance de execução de plugins (duração, erros, frequência)",
      GetPluginPerformanceSchema.shape,
      async (params: z.infer<typeof GetPluginPerformanceSchema>) => {
        const filters: string[] = [];
        if (params.minDuration) {
          filters.push(`performanceexecutionduration ge ${params.minDuration}`);
        }
        if (params.entityLogicalName) {
          filters.push(`contains(primaryentity,'${params.entityLogicalName}')`);
        }
    
        const result = await client.list("plugintracelogs", {
          select: [
            "typename", "messagename", "primaryentity",
            "performanceexecutionstarttime", "performanceexecutionduration",
            "operationtype", "exceptiondetails", "depth", "createdon",
            "correlationid", "issystemcreated",
          ],
          filter: filters.length > 0 ? filters.join(" and ") : undefined,
          orderby: "performanceexecutionduration desc",
          top: params.top,
        });
    
        // Calculate statistics
        const traces = result.value as Array<Record<string, unknown>>;
        const stats = {
          totalExecutions: traces.length,
          withErrors: traces.filter((t) => t.exceptiondetails).length,
          avgDuration: traces.length > 0
            ? Math.round(traces.reduce((sum, t) => sum + ((t.performanceexecutionduration as number) || 0), 0) / traces.length)
            : 0,
          maxDuration: traces.length > 0
            ? Math.max(...traces.map((t) => (t.performanceexecutionduration as number) || 0))
            : 0,
          slowestPlugins: traces.slice(0, 5).map((t) => ({
            name: t.typename,
            message: t.messagename,
            entity: t.primaryentity,
            duration: t.performanceexecutionduration,
            hasError: !!t.exceptiondetails,
          })),
        };
    
        return {
          content: [
            {
              type: "text" as const,
              text: `## Performance de Plugins\n\n**Resumo:**\n- Total de execuções analisadas: ${stats.totalExecutions}\n- Execuções com erro: ${stats.withErrors}\n- Duração média: ${stats.avgDuration}ms\n- Duração máxima: ${stats.maxDuration}ms\n\n**Top 5 Plugins mais lentos:**\n${stats.slowestPlugins.map((p, i) => `${i + 1}. **${p.name}** (${p.message} em ${p.entity}) - ${p.duration}ms ${p.hasError ? "⚠ COM ERRO" : ""}`).join("\n")}\n\n**Detalhes:**\n${JSON.stringify(traces.slice(0, 10), null, 2)}`,
            },
          ],
        };
      }
    );
  • Zod schema definition for input validation of the dynamics_get_plugin_performance tool.
    export const GetPluginPerformanceSchema = z.object({
      top: z.number().default(20).describe("Número de plugins a retornar"),
      minDuration: z.number().optional().describe("Duração mínima em ms para filtrar"),
      entityLogicalName: z.string().optional().describe("Filtrar por entidade"),
    });
  • Registration of the dynamics_get_plugin_performance tool within registerTelemetryTools.
    export function registerTelemetryTools(
      server: { tool: Function },
      client: DataverseClient
    ) {
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions analyzing duration, errors, and frequency, but lacks details on permissions, rate limits, output format, or whether it's a read-only operation. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence in Portuguese that directly states the tool's purpose without unnecessary words. It's front-loaded and appropriately sized for its content.

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?

Given the tool's complexity (performance analysis with three parameters) and lack of annotations and output schema, the description is incomplete. It doesn't explain the return values, error handling, or behavioral traits like data freshness or access requirements, leaving the agent with insufficient context for effective use.

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?

The schema description coverage is 100%, so the schema already documents all three parameters (top, minDuration, entityLogicalName). The description implies filtering by duration and entity but doesn't add syntax or format details beyond what the schema provides. With high schema coverage, the baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the tool's purpose: analyzing plugin execution performance by duration, errors, and frequency. It specifies the resource (plugins) and the type of analysis, though it doesn't explicitly differentiate from sibling tools like 'dynamics_get_slow_plugins' or 'dynamics_get_plugin_trace_logs' beyond the general performance focus.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'dynamics_get_slow_plugins' for similar performance analysis or 'dynamics_get_plugin_trace_logs' for error details, nor does it specify prerequisites or exclusions for usage.

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