powerbi-mcp 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- powerbi_mcp-0.1.0.dist-info/METADATA +540 -0
- powerbi_mcp-0.1.0.dist-info/RECORD +18 -0
- powerbi_mcp-0.1.0.dist-info/WHEEL +4 -0
- powerbi_mcp-0.1.0.dist-info/entry_points.txt +2 -0
- powerbi_mcp-0.1.0.dist-info/licenses/LICENSE +21 -0
- src/__init__.py +13 -0
- src/auth.py +136 -0
- src/client.py +259 -0
- src/constants.py +26 -0
- src/exceptions.py +96 -0
- src/formatters.py +367 -0
- src/models.py +85 -0
- src/server.py +90 -0
- src/tools/__init__.py +15 -0
- src/tools/datasets.py +355 -0
- src/tools/queries.py +125 -0
- src/tools/workspaces.py +185 -0
- src/validation.py +40 -0
src/validation.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Validation utilities for PowerBI MCP Server
|
|
3
|
+
|
|
4
|
+
Shared validation logic to ensure consistency across the codebase.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .constants import REFRESH_HISTORY_MIN, REFRESH_HISTORY_MAX
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def validate_dax_query(query: str) -> None:
|
|
11
|
+
"""
|
|
12
|
+
Validate that DAX query starts with EVALUATE keyword
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
query: DAX query string to validate
|
|
16
|
+
|
|
17
|
+
Raises:
|
|
18
|
+
ValueError: If query doesn't start with EVALUATE
|
|
19
|
+
"""
|
|
20
|
+
if not query.strip().upper().startswith("EVALUATE"):
|
|
21
|
+
raise ValueError(
|
|
22
|
+
"DAX query must start with EVALUATE keyword. "
|
|
23
|
+
'Example: "EVALUATE Sales" or "EVALUATE FILTER(Sales, Sales[Year] = 2024)"'
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def validate_refresh_top(top: int) -> None:
|
|
28
|
+
"""
|
|
29
|
+
Validate refresh history top parameter
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
top: Number of refresh records to return
|
|
33
|
+
|
|
34
|
+
Raises:
|
|
35
|
+
ValueError: If top is out of valid range
|
|
36
|
+
"""
|
|
37
|
+
if not REFRESH_HISTORY_MIN <= top <= REFRESH_HISTORY_MAX:
|
|
38
|
+
raise ValueError(
|
|
39
|
+
f"top must be between {REFRESH_HISTORY_MIN} and {REFRESH_HISTORY_MAX}"
|
|
40
|
+
)
|