Skip to main content
Glama
rafteles2016

MCP Dynamics CRM Server

by rafteles2016

dynamics_get_audit_history

Retrieve audit history records from Dynamics CRM to track system changes, user activities, and data modifications for compliance and troubleshooting.

Instructions

Consulta histórico de auditoria do sistema

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entityLogicalNameNo
userIdNo
topNo
operationNoall

Implementation Reference

  • The handler function for 'dynamics_get_audit_history' that queries the Dynamics API for audit records based on input filters.
    server.tool(
      "dynamics_get_audit_history",
      "Consulta histórico de auditoria do sistema",
      GetAuditHistorySchema.shape,
      async (params: z.infer<typeof GetAuditHistorySchema>) => {
        const filters: string[] = [];
        if (params.entityLogicalName) {
          filters.push(`objecttypecode eq '${params.entityLogicalName}'`);
        }
        if (params.userId) {
          filters.push(`_userid_value eq '${params.userId}'`);
        }
        if (params.operation !== "all") {
          const opMap: Record<string, number> = { Create: 1, Update: 2, Delete: 3 };
          filters.push(`operation eq ${opMap[params.operation]}`);
        }
    
        const result = await client.list("audits", {
          select: [
            "auditid", "objecttypecode", "operation", "action",
            "_userid_value", "createdon", "changedata",
          ],
          filter: filters.length > 0 ? filters.join(" and ") : undefined,
          orderby: "createdon desc",
          top: params.top,
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: `## Histórico de Auditoria\n\nRegistros: ${result.value.length}\n\n${JSON.stringify(result.value, null, 2)}`,
            },
          ],
        };
      }
    );
  • Zod schema definition for 'dynamics_get_audit_history' input validation.
    export const GetAuditHistorySchema = z.object({
      entityLogicalName: z.string().optional(),
      userId: z.string().optional(),
      top: z.number().default(50),
      operation: z.enum(["all", "Create", "Update", "Delete"]).default("all"),
    });
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 for behavioral disclosure. It states this is a query operation ('consulta'), implying it's likely read-only, but doesn't confirm this or provide any other behavioral context like authentication requirements, rate limits, pagination behavior, or what happens when parameters are omitted. For a tool with 4 parameters and no 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 that gets straight to the point without unnecessary words. It's appropriately sized for a basic tool description, though it could benefit from being more specific about scope or usage.

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 complexity (4 parameters with 0% schema coverage, no annotations, no output schema), the description is insufficiently complete. It doesn't explain what the tool returns, how parameters interact, what the default behavior is when parameters are omitted, or any constraints or prerequisites for using this audit functionality.

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

Parameters2/5

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

Schema description coverage is 0%, meaning none of the 4 parameters have descriptions in the schema. The tool description provides no information about what entityLogicalName, userId, top, or operation mean or how they should be used. While one parameter has an enum (operation), the description doesn't explain what these operation types refer to in the audit context.

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 'Consulta histórico de auditoria do sistema' (Portuguese for 'Query system audit history') clearly states the verb ('query') and resource ('system audit history'), establishing the basic purpose. However, it doesn't differentiate this tool from its many siblings (like dynamics_get_active_processes, dynamics_get_system_jobs) that also retrieve various system data, leaving the scope somewhat vague.

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. With 40+ sibling tools, including many other 'get' operations, there's no indication of what makes audit history distinct or when it's appropriate to query audit logs instead of other system data like processes, jobs, or views.

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