Skip to content

Commit 29c2e5d

Browse files
joeconstantinocursoragentanyoung-tableau
authored
@W-21984866 docs for new getDatasourceMetadata tool response format (#335)
* docs for new getDatasourceMetadata tool response format * package version patch * Sync package-lock.json with main. Replaces unintended lockfile drift on this branch so PR #335 matches the current main baseline. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Andy Young <andrew.young@tableau.com>
1 parent 532f139 commit 29c2e5d

1 file changed

Lines changed: 83 additions & 187 deletions

File tree

docs/docs/tools/data-qna/get-datasource-metadata.md

Lines changed: 83 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ sidebar_position: 2
44

55
# Get Datasource Metadata
66

7-
Fetches field metadata for the specified datasource.
7+
Fetches datasource metadata for the specified datasource, including:
8+
9+
- datasource description
10+
- datasource model relationships (when available)
11+
- fields grouped by `logicalTableId`
12+
- Tableau parameters
813

914
## APIs called
1015

1116
- [Request data source metadata](https://help.tableau.com/current/api/vizql-data-service/en-us/reference/index.html#tag/HeadlessBI/operation/ReadMetadata)
17+
- [Request data source model](https://help.tableau.com/current/api/vizql-data-service/en-us/reference/index.html#tag/HeadlessBI/operation/GetDatasourceModel)
1218
- [Metadata API](https://help.tableau.com/current/api/metadata_api/en-us/index.html)
1319
- [Query Data Source](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#query_data_source)
1420
(if applicable [tool scoping](../../configuration/mcp-config/tool-scoping.md) is enabled)
@@ -26,196 +32,86 @@ tool.
2632

2733
Example: `2d935df8-fe7e-4fd8-bb14-35eb4ba31d45`
2834

35+
## Response shape
36+
37+
Top-level keys are returned in this order:
38+
39+
1. `datasourceDescription`
40+
2. `datasourceModel` (optional)
41+
3. `fieldGroups`
42+
4. `parameters`
43+
44+
`datasourceModel` is available on Tableau versions that support the VDS `get-datasource-model`
45+
endpoint (2025.3+). On older versions, it is omitted.
46+
2947
## Example result
3048

3149
```json
3250
{
33-
"fields": [
34-
{
35-
"name": "Returned",
36-
"dataType": "STRING",
37-
"columnClass": "COLUMN",
38-
"defaultAggregation": "COUNT",
39-
"dataCategory": "NOMINAL",
40-
"role": "DIMENSION"
41-
},
42-
{
43-
"name": "Category",
44-
"dataType": "STRING",
45-
"columnClass": "COLUMN",
46-
"defaultAggregation": "COUNT",
47-
"dataCategory": "NOMINAL",
48-
"role": "DIMENSION"
49-
},
50-
{
51-
"name": "Discount",
52-
"dataType": "REAL",
53-
"columnClass": "COLUMN",
54-
"defaultAggregation": "SUM",
55-
"dataCategory": "QUANTITATIVE",
56-
"role": "MEASURE"
57-
},
58-
{
59-
"name": "Postal Code",
60-
"dataType": "STRING",
61-
"columnClass": "COLUMN",
62-
"defaultAggregation": "COUNT",
63-
"dataCategory": "ORDINAL",
64-
"role": "DIMENSION",
65-
"defaultFormat": "*00000"
66-
},
67-
{
68-
"name": "Regional Manager",
69-
"dataType": "STRING",
70-
"defaultAggregation": "COUNT"
71-
},
72-
{
73-
"name": "Order ID",
74-
"dataType": "STRING",
75-
"columnClass": "COLUMN",
76-
"defaultAggregation": "COUNT",
77-
"dataCategory": "NOMINAL",
78-
"role": "DIMENSION"
79-
},
80-
{
81-
"name": "Product Name",
82-
"dataType": "STRING",
83-
"columnClass": "COLUMN",
84-
"defaultAggregation": "COUNT",
85-
"dataCategory": "NOMINAL",
86-
"role": "DIMENSION"
87-
},
88-
{
89-
"name": "Ship Date",
90-
"dataType": "DATE",
91-
"columnClass": "COLUMN",
92-
"defaultAggregation": "YEAR",
93-
"dataCategory": "ORDINAL",
94-
"role": "DIMENSION"
95-
},
96-
{
97-
"name": "Quantity",
98-
"dataType": "INTEGER",
99-
"columnClass": "COLUMN",
100-
"defaultAggregation": "SUM",
101-
"dataCategory": "QUANTITATIVE",
102-
"role": "MEASURE"
103-
},
104-
{
105-
"name": "City",
106-
"dataType": "STRING",
107-
"columnClass": "COLUMN",
108-
"defaultAggregation": "COUNT",
109-
"dataCategory": "NOMINAL",
110-
"role": "DIMENSION"
111-
},
112-
{
113-
"name": "Sub-Category",
114-
"dataType": "STRING",
115-
"columnClass": "COLUMN",
116-
"defaultAggregation": "COUNT",
117-
"dataCategory": "NOMINAL",
118-
"role": "DIMENSION"
119-
},
120-
{
121-
"name": "Profit (bin)",
122-
"dataType": "INTEGER",
123-
"columnClass": "BIN",
124-
"defaultAggregation": "NONE",
125-
"formula": "[Profit]",
126-
"dataCategory": "ORDINAL",
127-
"role": "DIMENSION"
128-
},
129-
{
130-
"name": "Segment",
131-
"dataType": "STRING",
132-
"columnClass": "COLUMN",
133-
"defaultAggregation": "COUNT",
134-
"dataCategory": "NOMINAL",
135-
"role": "DIMENSION"
136-
},
137-
{
138-
"name": "State/Province",
139-
"dataType": "STRING",
140-
"columnClass": "COLUMN",
141-
"defaultAggregation": "COUNT",
142-
"dataCategory": "NOMINAL",
143-
"role": "DIMENSION"
144-
},
145-
{
146-
"name": "Sales",
147-
"dataType": "REAL",
148-
"columnClass": "COLUMN",
149-
"defaultAggregation": "SUM",
150-
"dataCategory": "QUANTITATIVE",
151-
"role": "MEASURE"
152-
},
153-
{
154-
"name": "Manufacturer",
155-
"dataType": "STRING",
156-
"columnClass": "GROUP",
157-
"defaultAggregation": "COUNT",
158-
"dataCategory": "NOMINAL",
159-
"role": "DIMENSION"
160-
},
161-
{
162-
"name": "Region",
163-
"dataType": "STRING",
164-
"columnClass": "COLUMN",
165-
"defaultAggregation": "COUNT",
166-
"dataCategory": "NOMINAL",
167-
"role": "DIMENSION"
168-
},
169-
{
170-
"name": "Ship Mode",
171-
"dataType": "STRING",
172-
"columnClass": "COLUMN",
173-
"defaultAggregation": "COUNT",
174-
"dataCategory": "NOMINAL",
175-
"role": "DIMENSION"
176-
},
177-
{
178-
"name": "Order Date",
179-
"dataType": "DATE",
180-
"columnClass": "COLUMN",
181-
"defaultAggregation": "YEAR",
182-
"dataCategory": "ORDINAL",
183-
"role": "DIMENSION"
184-
},
185-
{
186-
"name": "Profit",
187-
"dataType": "REAL",
188-
"columnClass": "COLUMN",
189-
"defaultAggregation": "SUM",
190-
"dataCategory": "QUANTITATIVE",
191-
"role": "MEASURE"
192-
},
193-
{
194-
"name": "Country/Region",
195-
"dataType": "STRING",
196-
"columnClass": "COLUMN",
197-
"defaultAggregation": "COUNT",
198-
"dataCategory": "NOMINAL",
199-
"role": "DIMENSION"
200-
},
201-
{
202-
"name": "Profit Ratio",
203-
"dataType": "REAL",
204-
"columnClass": "CALCULATION",
205-
"defaultAggregation": "AGG",
206-
"formula": "SUM([Profit])/SUM([Sales])",
207-
"dataCategory": "QUANTITATIVE",
208-
"role": "MEASURE",
209-
"isAutoGenerated": false,
210-
"hasUserReference": false
211-
},
212-
{
213-
"name": "Customer Name",
214-
"dataType": "STRING",
215-
"columnClass": "COLUMN",
216-
"defaultAggregation": "COUNT",
217-
"dataCategory": "NOMINAL",
218-
"role": "DIMENSION"
51+
"datasourceDescription": "Datasource metadata and usage notes...",
52+
"datasourceModel": {
53+
"logicalTables": [
54+
{
55+
"logicalTableId": "Orders_...",
56+
"caption": "Orders"
57+
},
58+
{
59+
"logicalTableId": "Returns_...",
60+
"caption": "Returns"
61+
}
62+
],
63+
"logicalTableRelationships": [
64+
{
65+
"fromLogicalTable": { "logicalTableId": "Orders_..." },
66+
"toLogicalTable": { "logicalTableId": "Returns_..." },
67+
"expression": {
68+
"relationships": [
69+
{
70+
"operator": "=",
71+
"fromField": "[Order ID]",
72+
"toField": "[Order ID (Returns)]"
73+
}
74+
]
75+
}
76+
}
77+
]
78+
},
79+
"fieldGroups": [
80+
{
81+
"logicalTableId": "Orders_...",
82+
"fields": [
83+
{
84+
"name": "Order ID",
85+
"dataType": "STRING",
86+
"columnClass": "COLUMN",
87+
"logicalTableId": "Orders_...",
88+
"defaultAggregation": "COUNT",
89+
"dataCategory": "NOMINAL",
90+
"role": "DIMENSION"
91+
},
92+
{
93+
"name": "Sales",
94+
"dataType": "REAL",
95+
"columnClass": "COLUMN",
96+
"logicalTableId": "Orders_...",
97+
"defaultAggregation": "SUM",
98+
"dataCategory": "QUANTITATIVE",
99+
"role": "MEASURE"
100+
}
101+
]
102+
},
103+
{
104+
"logicalTableId": null,
105+
"fields": [
106+
{
107+
"name": "CrossTable Calc",
108+
"dataType": "REAL",
109+
"columnClass": "CALCULATION",
110+
"logicalTableId": null,
111+
"defaultAggregation": "SUM",
112+
"formula": "[Sales] / NULLIF([Quantity], 0)"
113+
}
114+
]
219115
}
220116
],
221117
"parameters": [

0 commit comments

Comments
 (0)