Skip to main content
Glama

get_table_data

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

Instructions

Get sample data from a table with optional filtering and limiting

Input Schema

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

Implementation Reference

  • Core handler function that builds and executes a paginated SELECT query to retrieve table data.
    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); }
  • Tool definition including name, description, and input schema for validation.
    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)
    Dispatch handler in main server that routes tool calls to the DatabaseToolsHandler.getTableData method.
    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