Skip to main content
Glama
snahrup

Microsoft Fabric MCP Server

by snahrup

execute_dax_query

Execute DAX queries on Power BI datasets to analyze data and retrieve insights through the Microsoft Fabric MCP Server.

Instructions

Execute a DAX query on a Power BI dataset

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasetIdYesThe ID of the dataset
queryYesThe DAX query to execute

Implementation Reference

  • The implementation of the executeDaxQuery method in the PowerBIClient class.
    async executeDaxQuery(datasetId: string, query: string): Promise<DaxQueryResult> {
      try {
        const response = await this.apiClient.post(`/datasets/${datasetId}/executeQueries`, {
          queries: [
            {
              query: query
            }
          ]
        });
        return response.data;
      } catch (error) {
        console.error('Error executing DAX query:', error);
        throw error;
      }
    }
  • src/index.ts:172-183 (registration)
    The MCP tool handler for 'execute_dax_query' in src/index.ts.
    case 'execute_dax_query': {
      const { datasetId, query } = ExecuteDaxQuerySchema.parse(args);
      const result = await powerBIClient.executeDaxQuery(datasetId, query);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • The Zod schema validation for the 'execute_dax_query' tool arguments.
    const ExecuteDaxQuerySchema = z.object({
      datasetId: z.string().describe('The ID of the dataset'),
      query: z.string().describe('The DAX query to execute'),
    });

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/snahrup/microsoft-fabric-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server