Skip to main content
Glama
shadow-dba

mssql-dba-mcp

by shadow-dba

Read SQL Server Error Log

mssql_error_log
Read-onlyIdempotent

Read SQL Server ERRORLOG or Agent logs via sp_readerrorlog, filter lines by search strings, select archived files, and return newest entries first for troubleshooting.

Instructions

Error log: read the SQL Server ERRORLOG (or SQL Server Agent log) via sp_readerrorlog. Optionally filter to lines containing one or two search strings (e.g. "Backup", "3013") and select an archived log file. Returns newest entries first. Needs VIEW ANY ERROR LOG (SQL Server 2022+ / Managed Instance) or securityadmin. Not available on Azure SQL Database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
logTypeNo1 = SQL Server error log (default), 2 = SQL Server Agent error log.
maxRowsNoCap on rows returned, newest first (default 100, max 1000).
search1NoOnly return lines containing this string (e.g. "Backup").
search2NoFurther narrow to lines that also contain this string (e.g. "3013"). Applied in addition to search1.
logNumberNoWhich log file: 0 = current ERRORLOG, 1 = most recent archive, 2 = next older, etc. Defaults to 0.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already cover the read-only/idempotent/non-destructive safety profile, so the bar is lower. The description still adds real operational context beyond them: required permissions (VIEW ANY ERROR LOG, SQL Server 2022+/MI, or securityadmin), platform exclusion, and result ordering ('newest entries first').

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?

One dense paragraph, front-loaded with the core action, then filters, then ordering, then prerequisites and platform limits. Every clause carries information an agent needs; nothing is padding.

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

Completeness5/5

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

For a read-only, no-required-param tool with full schema coverage and no output schema, the description covers purpose, filtering, ordering, permissions, and availability. 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 five parameters are already documented in the schema, including the logType enum, maxRows cap, and logNumber semantics. The description restates the two-search-string combination and the archived-log concept without adding syntax or format detail beyond the schema, so it sits at the baseline.

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 (read the SQL Server ERRORLOG or Agent log via sp_readerrorlog) and immediately distinguishes it from siblings like mssql_agent_jobs and mssql_recent_backups by scoping to raw log lines. An agent can identify this as the log-text reader without opening the schema.

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

Usage Guidelines4/5

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

Gives clear operating context: filtering by one or two strings, selecting an archived log, and a hard availability exclusion ('Not available on Azure SQL Database'). It does not name a sibling alternative for related needs (e.g. when to prefer a structured check like mssql_agent_failed_jobs), so it stops short of explicit when-not-to-use-this routing.

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