Skip to main content
Glama
dhipskind253

mssql-mcp

by dhipskind253

list_views

List all views in a SQL Server database, optionally filtered by schema, to facilitate database exploration.

Instructions

List views, optionally filtered by schema.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaNo

Implementation Reference

  • The actual implementation of listViews – queries sys.views and sys.schemas for view names, optionally filtered by schema.
    async listViews(schema?: string) {
      const r = await (await this.getPool())
        .request()
        .input('schema', sql.NVarChar, schema ?? null).query(`
          SELECT s.name AS schema_name, v.name AS view_name
          FROM sys.views v
          INNER JOIN sys.schemas s ON v.schema_id = s.schema_id
          WHERE (@schema IS NULL OR s.name = @schema)
          ORDER BY s.name, v.name
        `);
      return r.recordset;
    }
  • src/index.ts:110-117 (registration)
    Registers the 'list_views' MCP tool with an optional schema parameter and wires it to db.listViews.
    server.tool(
      'list_views',
      'List views, optionally filtered by schema.',
      {
        schema: z.string().optional(),
      },
      async ({ schema }) => runTool(() => db.listViews(schema))
    );
  • Zod schema definition for the 'list_views' tool: optional schema string parameter.
    {
      schema: z.string().optional(),
    },
  • The runTool helper wraps the handler call with try/catch and formats the result (success JSON or error).
    async function runTool(fn: () => Promise<unknown>): Promise<ToolResult> {
      try {
        const value = await fn();
        const text =
          typeof value === 'string' ? value : JSON.stringify(value, null, 2);
        return { content: [{ type: 'text', text }] };
      } catch (err) {
        return {
          content: [{ type: 'text', text: formatDbError(err) }],
          isError: true,
        };
      }
    }
Behavior2/5

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

With no annotations, the description must fully convey behavioral traits. It merely states 'List views' without clarifying return format, safety (read-only implied but not explicit), auth requirements, or error handling.

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 extremely concise (one sentence) and easy to parse. However, it could be slightly more structured by front-loading the resource and then the filter option.

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

Completeness2/5

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

Given the tool's simplicity (one optional param, no output schema), the description is incomplete: it does not specify what information is returned (e.g., view names, definitions) or how the schema filter works.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage for the 'schema' parameter, and the description only says 'optionally filtered by schema' without explaining the expected format (e.g., exact name, pattern, or whether it's required).

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

Purpose4/5

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

The description clearly states the tool lists views with an optional schema filter. However, it does not differentiate from sibling listing tools like list_tables or list_schemas, which follow similar patterns.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives such as describe_table or get_view_definition. The description lacks context about prerequisites or exclusion criteria.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dhipskind253/mssql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server