Skip to main content
Glama

get_table_data

Retrieve sample data from SQL Server tables with optional filtering and row limits for database analysis and exploration.

Instructions

Get sample data from a table with optional filtering and limiting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYesName of the table
databaseNoDatabase name (optional)
schemaNoSchema name (optional, defaults to dbo)
limitNoMaximum number of rows to return (optional, defaults to 100)
whereNoWHERE clause conditions (optional)

Implementation Reference

  • Main implementation of get_table_data tool: constructs paginated SELECT query for the specified table and executes it via executeQuery
    /** * Get table data with pagination support */ async getTableData(tableName, database = null, schema = 'dbo', limit = 100, offset = 0) { let query; if (database) { query = ` SELECT * FROM [${database}].[${schema}].[${tableName}] ORDER BY (SELECT NULL) OFFSET ${offset} ROWS FETCH NEXT ${limit} ROWS ONLY `; } else { query = ` SELECT * FROM [${schema}].[${tableName}] ORDER BY (SELECT NULL) OFFSET ${offset} ROWS FETCH NEXT ${limit} ROWS ONLY `; } const result = await this.executeQuery(query, 'get_table_data'); return this.formatResults(result); }
  • Input schema and metadata definition for the get_table_data tool used in tool listing
    { name: 'get_table_data', description: 'Get sample data from a table with optional filtering and limiting', inputSchema: { type: 'object', properties: { table_name: { type: 'string', description: 'Name of the table' }, database: { type: 'string', description: 'Database name (optional)' }, schema: { type: 'string', description: 'Schema name (optional, defaults to dbo)' }, limit: { type: 'number', description: 'Maximum number of rows to return (optional, defaults to 100)' }, where: { type: 'string', description: 'WHERE clause conditions (optional)' } }, required: ['table_name'] } },
  • index.js:287-296 (registration)
    Registration and dispatch of get_table_data tool call to the DatabaseToolsHandler in the main MCP server switch statement
    case 'get_table_data': return { content: await this.databaseTools.getTableData( args.table_name, args.database, args.schema, args.limit, args.offset ) };

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/egarcia74/warp-sql-server-mcp'

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