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.

GetObject is the unified entry point for retrieving the definition and metadata of any SQL Server programmable object. Supply an objectType and the object name, and the tool routes internally to the appropriate handler: GetStoredProc for procedures, GetFunction for scalar and table-valued functions, and GetTrigger for DML triggers. All three sub-handlers return the object’s metadata, its parameter list (where applicable), and its full T-SQL source from OBJECT_DEFINITION(). When the AI Insights layer is active, the response also includes cached insight data and enrichment instructions for each object type.

Parameters

objectType
string
required
The kind of programmable object to retrieve. Accepted canonical values and their common aliases:
Canonical valueAccepted aliases
StoredProcedurestoredprocedures, procedure, procedures, proc, procs, sp, sps
FunctionscalarFunction, tableFunction, scalarFunctions, tableFunctions, functions, fn
Triggertriggers, tr
Aliases are case-insensitive and ignore hyphens and underscores.
name
string
required
The object name. Accepted forms depend on the object type:
  • StoredProcedure / Function: name or schema.name (e.g. usp_GetOrder or dbo.usp_GetOrder).
  • Trigger: name, schema.name, or the three-part form schema.table.name (e.g. trgAudit, dbo.trgAudit, or dbo.Orders.trgAudit).
Schema-qualified names are recommended whenever the same name could appear in multiple schemas.

Returns

The top-level response key varies by object type (procedure, function, or trigger).
procedure
object
Returned when objectType=StoredProcedure.
function
object
Returned when objectType=Function.
trigger
object
Returned when objectType=Trigger.
parameters
array
Input and output parameters for stored procedures and functions. Empty array when the object has no parameters. Not present for triggers.
definition
string | null
Full T-SQL source as returned by OBJECT_DEFINITION(). null when the object was created WITH ENCRYPTION or the definition is otherwise unavailable.
insight
string | null
Cached AI Insights text. Present only when the Insights layer is enabled. null when no insight has been generated.
insightFreshness
string | null
ISO 8601 timestamp of the last insight write. null when no insight exists.
enrichmentSuggested
boolean | null
true when the Insights layer recommends agent enrichment.
insightEnrichment
object | null
Structured enrichment instructions (MCP-Insight-Enrichment-v1).

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.

Usage notes

For triggers, three-part name parsing (schema.table.name) is handled internally by TriggerQualifiedName.Parse(). The last dot-separated segment is always treated as the trigger name, the first as the schema, and the middle segment (when present) as the table name. This allows unambiguous lookup when the same trigger name exists on tables in different schemas.
When you only know the trigger name but not its parent table, pass just the name (e.g. trgOrdersAudit) and the server searches across all tables. Add schema or table qualifiers to narrow the result when the name is not unique.
GetObject covers all function subtypes (FN, TF, IF, FT in sys.objects.type). You do not need to specify whether the function is scalar or table-valued — the type_desc field in the response tells you which kind was found.

Examples

Request — stored procedure

{
  "tool": "GetObject",
  "arguments": {
    "objectType": "StoredProcedure",
    "name": "dbo.usp_GetOrderById"
  }
}

Response — stored procedure

{
  "success": true,
  "data": {
    "procedure": {
      "schema": "dbo",
      "name": "usp_GetOrderById",
      "create_date": "2023-11-14T09:22:01",
      "modify_date": "2024-03-05T14:10:33",
      "description": "Returns a single order by primary key."
    },
    "parameters": [
      {
        "name": "@OrderId",
        "type": "int",
        "max_length": 4,
        "precision": 10,
        "scale": 0,
        "is_output": false,
        "has_default_value": false,
        "default_value": null
      }
    ],
    "definition": "CREATE PROCEDURE dbo.usp_GetOrderById\n    @OrderId INT\nAS\nBEGIN\n    SELECT * FROM dbo.Orders WHERE OrderId = @OrderId;\nEND",
    "insight": null,
    "insightFreshness": null,
    "enrichmentSuggested": null,
    "insightEnrichment": null
  }
}

Request — trigger using three-part name

{
  "tool": "GetObject",
  "arguments": {
    "objectType": "Trigger",
    "name": "dbo.Orders.trgOrdersAudit"
  }
}

Response — trigger

{
  "success": true,
  "data": {
    "trigger": {
      "schema": "dbo",
      "table_name": "Orders",
      "name": "trgOrdersAudit",
      "create_date": "2023-11-20T10:00:00",
      "modify_date": "2024-02-01T08:45:00",
      "is_disabled": false,
      "is_instead_of_trigger": false,
      "trigger_events": "INSERT, UPDATE",
      "description": null
    },
    "definition": "CREATE TRIGGER dbo.trgOrdersAudit\nON dbo.Orders\nAFTER INSERT, UPDATE\nAS\nBEGIN\n    INSERT INTO dbo.OrderAudit (OrderId, ChangedAt)\n    SELECT OrderId, GETUTCDATE() FROM inserted;\nEND",
    "insight": null,
    "insightFreshness": null,
    "enrichmentSuggested": null,
    "insightEnrichment": null
  }
}

Build docs developers (and LLMs) love