Skip to main content
Glama

appinsights_query

Read-onlyIdempotent

Run a raw KQL (Kusto) query against the D365FO environment's Application Insights / Log Analytics workspace (read-only -- the query language has no mutation operators). Requires the connection to be configured first via appinsights_set_connection (or server env vars). Use the standard App Insights schema: requests, dependencies, exceptions, traces, customEvents, pageViews, performanceCounters. Prefer appinsights_diagnose_slowness for a ready-made "why is it slow" report -- use this tool for anything more specific/custom.

Triggers: 'run this KQL', 'query app insights', 'requête KQL', 'log analytics query', 'custom App Insights query for my environment'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kqlYesKQL query text, e.g. "exceptions | where timestamp > ago(1h) | take 20". Do NOT include an explicit 'ago()'/time-range filter for the primary time column -- use the lookbackHours parameter instead (applied as the query time range).
maxRowsNoMax rows to return (1-500). Default 100.
lookbackHoursNoHow far back to query, in hours (1-720). Default 24.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and non-destructive behavior. The description adds useful context beyond this: the KQL language has no mutation operators, a connection must be configured first, and the standard App Insights schema is expected. This is valuable behavioral disclosure without contradicting the annotations.

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 front-loaded with the core action and then adds prerequisites, schema guidance, and sibling routing. The trigger-phrase list is slightly long but useful for selection. Minor redundancy exists with the annotations around read-only behavior, but it does not harm clarity.

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

Completeness4/5

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

Covers the prerequisite, the scope, the alternative tool, and the schema family. With all parameters already documented in the schema and safety covered by annotations, the main missing piece is an explicit statement of the result shape, but for a raw query tool the returned table is fairly self-explanatory.

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 documents all three parameters clearly, including the lookbackHours time-range behavior and maxRows limits. The description adds schema-context guidance (which tables are available) but no additional parameter-level semantics beyond what the schema provides.

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

Purpose5/5

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

States a specific verb and resource: 'Run a raw KQL query against the D365FO environment's Application Insights / Log Analytics workspace.' It also explicitly distinguishes itself from appinsights_diagnose_slowness, so an agent can tell which tool to pick.

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

Usage Guidelines5/5

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

Provides explicit when-to-use guidance: prefer appinsights_diagnose_slowness for a ready-made slowdown report, use this tool for more specific/custom queries. It also names the prerequisite (configured connection via appinsights_set_connection or env vars) and includes trigger phrases.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.