Skip to main content
Glama
DynamicEndpoints

Microsoft 365 Core MCP Server

generate_professional_report

Create professional reports in PowerPoint, Word, HTML, or PDF formats using Microsoft 365 data for security analysis, compliance audits, user activity tracking, and device health monitoring.

Instructions

Generate comprehensive professional reports in multiple formats (PowerPoint, Word, HTML, PDF) from Microsoft 365 data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reportTypeYesType of professional report to generate
titleYesReport title
descriptionNoReport description
dataQueriesNoData queries to execute and include in report
includeChartsNoInclude visual charts in the report
includeTablesNoInclude data tables in the report
includeSummaryNoInclude executive summary
outputFormatsYesOutput formats to generate (can select multiple)
driveIdNoOneDrive/SharePoint drive ID for saving reports
folderIdNoFolder ID within the drive
fileNamePrefixNoPrefix for generated file names
templateNoReport branding and styling

Implementation Reference

  • Main handler function that orchestrates data collection from Microsoft Graph, generates structured report content based on type, and creates output files in multiple formats (PPTX, DOCX, HTML, PDF) by calling specialized document handlers.
    export async function handleProfessionalReports(
      args: ProfessionalReportArgs,
      graphClient: Client
    ): Promise<string> {
      try {
        // Step 1: Collect data from specified sources
        const collectedData = await collectReportData(args.dataQueries || [], graphClient);
    
        // Step 2: Generate report content based on report type
        const reportContent = generateReportContent(args, collectedData);
    
        // Step 3: Create documents in requested formats
        const createdFiles = [];
    
        for (const format of args.outputFormats) {
          let result;
    
          switch (format) {
            case 'pptx':
              result = await createPowerPointReport(args, reportContent, graphClient);
              createdFiles.push({ format: 'pptx', ...result });
              break;
    
            case 'docx':
              result = await createWordReport(args, reportContent, graphClient);
              createdFiles.push({ format: 'docx', ...result });
              break;
    
            case 'html':
              result = await createHTMLReport(args, reportContent, graphClient);
              createdFiles.push({ format: 'html', ...result });
              break;
    
            case 'pdf':
              // PDF is generated by first creating Word and then converting
              result = await createPDFReport(args, reportContent, graphClient);
              createdFiles.push({ format: 'pdf', ...result });
              break;
          }
        }
    
        return JSON.stringify({
          success: true,
          reportType: args.reportType,
          title: args.title,
          filesCreated: createdFiles.length,
          files: createdFiles,
          dataSourcesQueried: args.dataQueries?.length || 0,
          message: `Professional report "${args.title}" generated successfully in ${createdFiles.length} format(s)`
        }, null, 2);
    
      } catch (error) {
        if (error instanceof McpError) throw error;
        throw new McpError(
          ErrorCode.InternalError,
          `Professional report generation failed: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • MCP server tool registration for 'generate_professional_report', linking the schema, metadata annotations, and execution handler.
    this.server.tool(
      "generate_professional_report",
      "Generate comprehensive professional reports in multiple formats (PowerPoint, Word, HTML, PDF) from Microsoft 365 data.",
      professionalReportArgsSchema.shape,
      {"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false},
      wrapToolHandler(async (args: ProfessionalReportArgs) => {
        this.validateCredentials();
        try {
          const result = await handleProfessionalReports(args, this.getGraphClient());
          return { content: [{ type: 'text', text: result }] };
        } catch (error) {
          if (error instanceof McpError) {
            throw error;
          }
          throw new McpError(
            ErrorCode.InternalError,
            `Error generating professional report: ${error instanceof Error ? error.message : 'Unknown error'}`
          );
        }
      })
    );
  • Zod input validation schema defining parameters for the professional report tool, including report type, data sources, output formats, and styling options.
    export const professionalReportArgsSchema = z.object({
      reportType: z.enum(['security-analysis', 'compliance-audit', 'user-activity', 'device-health', 'custom'])
        .describe('Type of professional report to generate'),
      title: z.string().describe('Report title'),
      description: z.string().optional().describe('Report description'),
      dataQueries: z.array(dataQuerySchema).optional()
        .describe('Data queries to execute and include in report'),
      includeCharts: z.boolean().optional()
        .describe('Include visual charts in the report'),
      includeTables: z.boolean().optional()
        .describe('Include data tables in the report'),
      includeSummary: z.boolean().optional()
        .describe('Include executive summary'),
      outputFormats: z.array(z.enum(['pptx', 'docx', 'html', 'pdf']))
        .describe('Output formats to generate (can select multiple)'),
      driveId: z.string().optional()
        .describe('OneDrive/SharePoint drive ID for saving reports'),
      folderId: z.string().optional()
        .describe('Folder ID within the drive'),
      fileNamePrefix: z.string().optional()
        .describe('Prefix for generated file names'),
      template: z.object({
        theme: z.string().optional(),
        companyName: z.string().optional(),
        companyLogo: z.string().optional(),
        primaryColor: z.string().optional().describe('Primary brand color (hex)'),
        secondaryColor: z.string().optional().describe('Secondary brand color (hex)')
      }).optional().describe('Report branding and styling')
    });
  • Tool metadata providing description, title, and annotations (readOnlyHint, destructiveHint, etc.) for the generate_professional_report tool.
    generate_professional_report: {
      description: "Generate comprehensive professional reports in multiple formats (PowerPoint, Word, HTML, PDF) from Microsoft 365 data.",
      title: "Professional Report Generator",
      annotations: { title: "Professional Report Generator", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }
    },
  • TypeScript interface defining the structure of ProfessionalReportArgs used by the handler and schema.
    export interface ProfessionalReportArgs {
      reportType: 'security-analysis' | 'compliance-audit' | 'user-activity' | 'device-health' | 'custom';
      title: string;
      description?: string;
      
      // Data sources
      dataQueries?: DataQuery[];
      includeCharts?: boolean;
      includeTables?: boolean;
      includeSummary?: boolean;
      
      // Output formats
      outputFormats: ('pptx' | 'docx' | 'html' | 'pdf')[];
      
      // Storage location
      driveId?: string;
      folderId?: string;
      fileNamePrefix?: string;
      
      // Styling
      template?: {
        theme?: string;
        companyName?: string;
        companyLogo?: string;
        primaryColor?: string;
        secondaryColor?: string;
      };
    }
    
    export interface DataQuery {
      source: 'users' | 'devices' | 'groups' | 'audit-logs' | 'alerts' | 'policies' | 'compliance';
      endpoint: string;
      filter?: string;
      select?: string[];
      transform?: 'count' | 'group-by' | 'aggregate' | 'trend';
      label: string;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate this is a non-readOnly, non-idempotent, non-destructive operation (write operation with potential side effects). The description adds context by specifying output formats and data source, but doesn't disclose behavioral traits like whether reports are saved automatically, if generation is asynchronous, rate limits, or authentication requirements. With annotations providing basic safety profile, the description adds some value but lacks rich behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence that efficiently conveys core functionality: action (generate), resource (reports), formats, and data source. No wasted words, perfectly front-loaded with the essential information. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 12 parameters, nested objects, no output schema, and annotations covering only basic hints, the description is minimally adequate. It covers what the tool does at a high level but doesn't address important context like report structure, generation process, error handling, or how outputs are delivered. Given the complexity, more completeness would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema itself. The description mentions 'multiple formats' and 'Microsoft 365 data', which aligns with 'outputFormats' and the data-oriented parameters, but doesn't add meaningful semantics beyond what the schema already provides. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Generate' and the resource 'comprehensive professional reports', specifying output formats (PowerPoint, Word, HTML, PDF) and data source (Microsoft 365 data). It distinguishes from simpler siblings like 'generate_html_report' or 'generate_word_document' by offering multiple formats and data integration, but doesn't explicitly contrast with 'generate_audit_reports' which might overlap in purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives like 'generate_audit_reports' or other report-generation siblings. The description implies usage for professional reports from Microsoft 365 data, but lacks context on prerequisites, target audiences, or scenarios where this is preferred over simpler single-format tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/DynamicEndpoints/m365-core-mcp'

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