get_cds_view
Retrieve the DDL source definition of a CDS view from an SAP system using the view name, optionally specifying system ID.
Instructions
Fetch CDS view DDL source definition from SAP system
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>"
},
"name": "get_cds_view"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | CDS view name (e.g. I_BUSINESSPARTNER) | |
| system_id | No | SAP system ID (e.g. DEV). Omit to use default system. |
Implementation Reference
- src/mcp-server.ts:241-248 (registration)Tool 'get_cds_view' is registered in the ListToolsRequestSchema handler with input schema requiring a 'name' parameter (CDS view name).
name: "get_cds_view", description: "Fetch CDS view DDL source definition from SAP system", inputSchema: { type: "object" as const, properties: { name: { type: "string", description: "CDS view name (e.g. I_BUSINESSPARTNER)" }, ...SYSTEM_ID_PROP }, required: ["name"], }, }, - src/mcp-server.ts:1031-1037 (handler)Handler for 'get_cds_view': parses the name argument, then calls client.getSource() with the ADT URI for DDL sources (/sap/bc/adt/ddic/ddl/sources/{name}/source/main). Returns the CDS view DDL source code.
case "get_cds_view": { const { name: cdsName } = NameSchema.parse(args); const source = await client.getSource( `/sap/bc/adt/ddic/ddl/sources/${encodeURIComponent(cdsName.toUpperCase())}/source/main` ); return { content: [{ type: "text", text: source }] }; } - src/adt-client.ts:56-62 (helper)AdtClient.getSource() is the helper that performs the HTTP GET request to fetch source code from the SAP ADT system at the given path.
async getSource(path: string): Promise<string> { const response = await this.http.get<string>(path, { headers: { Accept: "text/plain" }, responseType: "text", }); return response.data; }