Skip to main content
Glama

query_workspace

Read-onlyIdempotent

Run bounded, read-only KQL queries against a single Log Analytics workspace to retrieve telemetry, logs, events, metrics, and time-series data. Use it for workspace analytics, not Azure resource inventory.

Instructions

Use for telemetry, logs, events, metrics, and time-series data stored in a Log Analytics workspace. Run bounded, read-only KQL against one workspace. Do not use for Azure resource inventory or configuration; use query_azure_resources for those.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "workspaceId": "<workspaceId>",
      "query": "<query>",
      "timespan": "<timespan>"
    },
    "name": "query_workspace"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesRead-only KQL with a result-limiting operator.
timespanYesISO 8601 duration back from now (P7D, PT12H), or an interval: start/end (2026-10-01T00:00:00Z/2026-10-02T00:00:00Z) or start/duration (2026-10-01T08:00:00Z/PT6H). Times need Z or an offset.
workspaceIdYesWorkspace ID (GUID) or the workspace's full ARM resource ID; list_workspaces returns both.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changedv0.5.0
    • changedInput schema / properties / timespan / description
      Previous value: -"ISO 8601 duration, such as PT1H."New value: +"ISO 8601 duration back from now (P7D, PT12H), or an interval: start/end (2026-10-01T00:00:00Z/2026-10-02T00:00:00Z) or start/duration (2026-10-01T08:00:00Z/PT6H). Times need Z or an offset."
    • addedInput schema / properties / timespan / minLength
      Added value: +1
    • removedInput schema / properties / timespan / pattern
      Removed value: -"^P(?!$).+"
    • changedInput schema / properties / workspaceId / description
      Previous value: -"Log Analytics workspace customer ID."New value: +"Workspace ID (GUID) or the workspace's full ARM resource ID; list_workspaces returns both."
    • removedInput schema / properties / workspaceId / format
      Removed value: -"uuid"
    • addedInput schema / properties / workspaceId / maxLength
      Added value: +512
    • addedInput schema / properties / workspaceId / minLength
      Added value: +1
    • removedInput schema / properties / workspaceId / pattern
      Removed value: -"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
  2. First observedv0.2.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive and openWorld, so the safety profile is covered. The description still adds real context beyond that: the query must be 'bounded' (result-limited) and is scoped to exactly 'one workspace'. It stops short of mentioning permissions, throttling, or result-size limits, which keeps it out of the top band.

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?

Three short sentences, front-loaded with the primary use case, then the scoping constraint, then the exclusion. Every clause carries routing or behavioral information; nothing is redundant.

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?

With a fully described three-parameter schema, strong annotations, and no output schema to explain, the definition covers scope, alternative, and safety adequately. Since KQL result shape is arbitrary, some hint about returned rows or caps could round it out, but nothing needed to invoke it correctly is missing.

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 all three parameters (query, timespan, workspaceId) are fully documented in the schema, including ISO 8601 duration formats and the GUID/ARM-ID duality. The description only echoes the 'bounded' constraint already implied by the schema's result-limiting note, adding no new parameter meaning — the baseline 3 applies.

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 bounded, read-only KQL against one workspace') and enumerates the data domains it covers (telemetry, logs, events, metrics, time-series). It also names the sibling it is not (query_azure_resources), so an agent can route correctly without opening any schema.

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?

Gives both a positive condition ('use for telemetry, logs, events, metrics...') and an explicit exclusion with a named alternative ('Do not use for Azure resource inventory or configuration; use query_azure_resources'). Both when-to-use and when-not-to-use are stated outright.

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