Skip to main content
Glama
cornelcroi

French Tax MCP Server

by cornelcroi

generate_tax_report

Create detailed French tax reports on specific topics using provided tax data. Generate formatted documents for income tax calculations and official government information.

Instructions

Generate a detailed report about a specific tax topic

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tax_dataYes
topic_nameYes
output_fileNo
formatNomarkdown
ctxNo

Implementation Reference

  • Registration of the MCP tool 'generate_tax_report' with decorator and thin wrapper handler that delegates to the core implementation.
    @mcp.tool(
        name="generate_tax_report",
        description="Generate a detailed report about a specific tax topic",
    )
    async def generate_tax_report_wrapper(
        tax_data: Dict[str, Any],
        topic_name: str,
        output_file: Optional[str] = None,
        format: str = "markdown",
        ctx: Optional[Context] = None,
    ) -> str:
        """Generate a tax information report.
    
        Args:
            tax_data: Tax information data
            topic_name: Name of the tax topic
            output_file: Optional path to save the report
            format: Output format ('markdown' or 'csv')
            ctx: MCP context for logging
    
        Returns:
            str: The generated report
        """
        try:
            if ctx:
                await ctx.info(f"Generating report for {topic_name}")
    
            report = await generate_tax_report(tax_data, topic_name, output_file, format)
            return report
        except Exception as e:
            if ctx:
                await ctx.error(f"Failed to generate tax report: {e}")
            return f"Error generating report: {str(e)}"
  • Core handler logic in ReportGenerator class: determines report type, generates Markdown or CSV reports using templates, and optionally saves to file.
    async def generate_tax_report(
        self,
        tax_data: Dict[str, Any],
        topic_name: str,
        output_file: Optional[str] = None,
        format: str = "markdown",
    ) -> str:
        """Generate a tax information report.
    
        Args:
            tax_data: Tax information data
            topic_name: Name of the tax topic
            output_file: Optional path to save the report
            format: Output format ('markdown' or 'csv')
    
        Returns:
            The generated report
        """
        logger.info(f"Generating report for {topic_name}")
    
        try:
            # Determine report type based on tax_data
            report_type = self._determine_report_type(tax_data, topic_name)
    
            # Generate report based on type
            if format.lower() == "csv":
                report = self._generate_csv_report(tax_data, topic_name, report_type)
            else:
                report = self._generate_markdown_report(tax_data, topic_name, report_type)
    
            # Save to file if output_file is specified
            if output_file:
                try:
                    output_path = Path(output_file)
                    output_path.parent.mkdir(parents=True, exist_ok=True)
                    with open(output_file, "w", encoding="utf-8") as f:
                        f.write(report)
                    logger.info(f"Report saved to {output_file}")
                except Exception as e:
                    logger.error(f"Failed to save report to {output_file}: {e}")
    
            return report
    
        except Exception as e:
            logger.error(f"Error generating tax report: {e}")
            return f"Error generating report: {str(e)}"
  • Top-level helper function and singleton instance that provides the imported generate_tax_report interface called by the MCP wrapper.
    report_generator = ReportGenerator()
    
    
    async def generate_tax_report(
        tax_data: Dict[str, Any],
        topic_name: str,
        output_file: Optional[str] = None,
        format: str = "markdown",
    ) -> str:
        """Generate a tax information report.
    
        Args:
            tax_data: Tax information data
            topic_name: Name of the tax topic
            output_file: Optional path to save the report
            format: Output format ('markdown' or 'csv')
    
        Returns:
            The generated report
        """
        return await report_generator.generate_tax_report(tax_data, topic_name, output_file, format)

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/cornelcroi/french-tax-mcp'

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