Skip to main content
Glama

get_tax_article

Retrieve detailed information about specific French tax law articles from the official Legifrance database to understand tax regulations and compliance requirements.

Instructions

Get information about a tax law article from legifrance.gouv.fr

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
article_idYes
ctxNo

Implementation Reference

  • MCP tool registration via @mcp.tool decorator and the wrapper handler function that invokes the scraper
    @mcp.tool( name="get_tax_article", description="Get information about a tax law article from legifrance.gouv.fr", ) async def get_tax_article_wrapper( article_id: str, ctx: Optional[Context] = None, ) -> Optional[Dict]: """Get information about a tax law article from legifrance.gouv.fr. Args: article_id: Article identifier (e.g., '200', '4B') ctx: MCP context for logging Returns: Dict: Dictionary containing article information """ try: if ctx: await ctx.info(f"Getting tax article information for {article_id}") result = await get_tax_article(article_id) return result except Exception as e: if ctx: await ctx.error(f"Failed to get tax article: {e}") return { "status": "error", "message": f"Error getting tax article: {str(e)}", }
  • Core handler function in LegalScraper class that performs the actual web scraping and extraction for the tax article
    async def get_tax_article(self, article_id: str) -> Dict: """Scrape information about a tax law article from legifrance.gouv.fr. Args: article_id: Article identifier (e.g., '200', '4B') Returns: Dictionary containing information about the article """ logger.info(f"Scraping information for article {article_id}") try: # Construct URL url = f"/codes/id/LEGITEXT000006069577/LEGIARTI000{article_id}" # Get the page response = await self.get_page(url) # Parse HTML soup = self.parse_html(response.text) # Extract article information article_info = self._extract_article_info(soup, article_id) return self.format_result( status="success", data=article_info, message=f"Successfully retrieved information for article {article_id}", source_url=f"{BASE_URL}{url}", ) except Exception as e: logger.error(f"Error scraping article information: {e}") return self.format_result( status="error", message=f"Failed to retrieve article information: {str(e)}", data={"article": article_id}, error=e, )
  • Thin wrapper function that calls the class method on the singleton LegalScraper instance; imported and used by server.py
    async def get_tax_article(article_id: str) -> Dict: """Scrape information about a tax law article from legifrance.gouv.fr. Args: article_id: Article identifier (e.g., '200', '4B') Returns: Dictionary containing information about the article """ return await legal_scraper.get_tax_article(article_id)

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