Skip to main content
Glama

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

  • Core handler function that collects data from Graph API queries, generates report content based on type, and creates documents in specified formats (PPTX, DOCX, HTML, PDF) by delegating to specialized 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 that maps 'generate_professional_report' to the handleProfessionalReports function with input schema validation and error handling.
    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 schema for validating input arguments to the generate_professional_report tool, including report type, data queries, 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') });
  • TypeScript interface defining the structure of arguments for professional report generation, 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; }; }
  • Tool metadata providing description, title, and annotations (hints) used during MCP tool registration and client discovery.
    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 } },

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