Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/A-Point-Systems-ltd/ms-sql-mcp/llms.txt

Use this file to discover all available pages before exploring further.

DescribeView returns a complete metadata snapshot of a single SQL Server view: identity fields (schema, name, object ID, creation and modification dates, description), an ordered column list with type information, and the full T-SQL definition sourced from OBJECT_DEFINITION() — the same text stored in sys.sql_modules. When the AI Insights layer is active it also attaches cached insight data. Prefer DescribeView over ad-hoc sys.sql_modules or INFORMATION_SCHEMA.VIEWS queries when you need the full definition and column details for a single view in one call.

Parameter

name
string
required
The view to describe. Accepts either of:
  • view_name — unqualified; the first matching view across all schemas is returned.
  • schema.view_name — schema-qualified (recommended when the same view name exists in multiple schemas).
Examples: ActiveCustomers, dbo.ActiveCustomers, reporting.MonthlySales.

Returns

view
object
View identity and timestamps.
columns
array
Ordered list of view columns as returned by sys.columns, ordered by column_id.
definition
string | null
Full T-SQL source of the view as returned by OBJECT_DEFINITION(). null when the definition is encrypted (WITH ENCRYPTION) or otherwise unavailable.
insight
string | null
Cached AI Insights text for this view. Present only when the Insights layer is enabled. null when no insight has been generated.
insightFreshness
string | null
ISO 8601 timestamp of when the cached insight was last written. null when no insight exists.
enrichmentSuggested
boolean | null
true when the Insights layer determines the cached data is incomplete and agent enrichment is required.
insightEnrichment
object | null
Structured enrichment instructions (MCP-Insight-Enrichment-v1). Contains required, nextAction.args, and relatedObjectsToIntrospect.

AI Insights enrichment protocol

MCP-Insight-Enrichment-v1 — mandatory post-call contract. When the response contains insightEnrichment.required=true, or includes a top-level _agentDirective or pendingEnrichments field, agents must call UpsertInsight using the arguments in insightEnrichment.nextAction.args (replacing every <fill in: ...> placeholder) before producing a final answer. Agents must also complete the enrichment loop for every entry in insightEnrichment.relatedObjectsToIntrospect.
For the full enrichment protocol specification, see the Enrichment Protocol reference page.

Usage notes

When a view’s definition is null because it was created WITH ENCRYPTION, you can still inspect its column list and use ReadData to query it — the definition itself is simply not accessible through OBJECT_DEFINITION().
DescribeView does not return index or foreign-key information. Views cannot have foreign keys and rarely have indexed views outside of data-warehouse contexts. Use ReadData with a sys.indexes query if you need to inspect an indexed view’s clustered index.

Example

Request

{
  "tool": "DescribeView",
  "arguments": {
    "name": "dbo.ActiveCustomers"
  }
}

Response

{
  "success": true,
  "data": {
    "view": {
      "schema": "dbo",
      "name": "ActiveCustomers",
      "id": 1045578337,
      "create_date": "2023-09-01T11:00:00",
      "modify_date": "2024-01-15T09:30:00",
      "description": "Customers with at least one order in the last 12 months."
    },
    "columns": [
      {
        "name": "CustomerId",
        "type": "int",
        "max_length": 4,
        "precision": 10,
        "scale": 0,
        "is_nullable": false
      },
      {
        "name": "FullName",
        "type": "nvarchar",
        "max_length": 200,
        "precision": 0,
        "scale": 0,
        "is_nullable": true
      },
      {
        "name": "LastOrderDate",
        "type": "datetime2",
        "max_length": 8,
        "precision": 27,
        "scale": 7,
        "is_nullable": true
      }
    ],
    "definition": "CREATE VIEW dbo.ActiveCustomers AS\nSELECT c.CustomerId, c.FullName, MAX(o.OrderDate) AS LastOrderDate\nFROM dbo.Customers c\nINNER JOIN dbo.Orders o ON c.CustomerId = o.CustomerId\nWHERE o.OrderDate >= DATEADD(YEAR, -1, GETUTCDATE())\nGROUP BY c.CustomerId, c.FullName",
    "insight": null,
    "insightFreshness": null,
    "enrichmentSuggested": null,
    "insightEnrichment": null
  }
}

Build docs developers (and LLMs) love