GetTableContents
Retrieve data from ABAP tables in SAP systems to analyze content, extract information, or debug applications by specifying table names and row limits.
Instructions
Retrieve contents of an ABAP table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes | Name of the ABAP table | |
| max_rows | No | Maximum number of rows to retrieve |
Implementation Reference
- The main handler function that implements the GetTableContents tool. It validates input, constructs a custom ADT URL for table contents, makes the request, and returns the response or error.export async function handleGetTableContents(args: any) { try { if (!args?.table_name) { throw new McpError(ErrorCode.InvalidParams, 'Table name is required'); } const maxRows = args.max_rows || 100; const encodedTableName = encodeURIComponent(args.table_name); //NOTE: This service requires a custom service implementation const url = `${await getBaseUrl()}/z_mcp_abap_adt/z_tablecontent/${encodedTableName}?maxRows=${maxRows}`; const response = await makeAdtRequest(url, 'GET', 30000); return return_response(response); } catch (error) { // Specific error message for GetTableContents since it requires custom implementation return return_error(error); } }
- src/index.ts:192-210 (schema)Defines the tool's metadata, description, and input schema including required 'table_name' and optional 'max_rows'.{ name: 'GetTableContents', description: 'Retrieve contents of an ABAP table', inputSchema: { type: 'object', properties: { table_name: { type: 'string', description: 'Name of the ABAP table' }, max_rows: { type: 'number', description: 'Maximum number of rows to retrieve', default: 100 } }, required: ['table_name'] } },
- src/index.ts:319-320 (registration)Registers and dispatches the CallToolRequest for 'GetTableContents' to the corresponding handler function.case 'GetTableContents': return await handleGetTableContents(request.params.arguments);
- src/index.ts:20-20 (registration)Imports the handler function for GetTableContents.import { handleGetTableContents } from './handlers/handleGetTableContents';