Skip to main content
Glama
cornelcroi

French Tax MCP Server

by cornelcroi

search_tax_law

Search French tax law articles on legifrance.gouv.fr to find specific regulations and legal provisions for tax compliance.

Instructions

Search for tax law articles on legifrance.gouv.fr

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
ctxNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Registration of the MCP tool named 'search_tax_law' using the @mcp.tool decorator.
    @mcp.tool(
        name="search_tax_law",
        description="Search for tax law articles on legifrance.gouv.fr",
    )
  • MCP tool handler wrapper for 'search_tax_law'. Logs the query using context and delegates execution to the imported 'search_tax_law' function from legal_scraper, handles exceptions.
    async def search_tax_law_wrapper(
        query: str,
        ctx: Optional[Context] = None,
    ) -> Optional[Dict]:
        """Search for tax law articles on legifrance.gouv.fr.
    
        Args:
            query: Search query
            ctx: MCP context for logging
    
        Returns:
            Dict: Dictionary containing search results
        """
        try:
            if ctx:
                await ctx.info(f"Searching tax law for: {query}")
    
            result = await search_tax_law(query)
            return result
        except Exception as e:
            if ctx:
                await ctx.error(f"Failed to search tax law: {e}")
            return {
                "status": "error",
                "message": f"Error searching tax law: {str(e)}",
            }
  • Core handler implementation within LegalScraper class. Builds a comprehensive Legifrance search URL targeting French tax codes (CGI etc.), scrapes the page, extracts results using BeautifulSoup, formats success/error responses.
    async def search_tax_law(self, query: str) -> Dict:
        """Search for tax law articles on legifrance.gouv.fr.
    
        Args:
            query: Search query
    
        Returns:
            Dictionary containing search results
        """
        logger.info(f"Searching for tax law articles with query: {query}")
    
        try:
            # Construct search URL with comprehensive parameters for tax code articles
            # This includes all article types (L, R, T, A, D, M, V, etc.) and specific tax codes
            # Build URL parameters
            base_params = (
                f"query={query}&corpus=CODES&typePagination=DEFAUT&pageSize=10&page=1"
                "&tab_selection=code&searchField=ALL&searchType=ALL"
            )
    
            # Article scope parameters (all types: L, R, T, A, D, M, V, etc.)
            article_scopes = [
                "CODE_ARTICLE",
                "CODE_ARTICLE_C",
                "CODE_ARTICLE_L",
                "CODE_ARTICLE_R",
                "CODE_ARTICLE_T",
                "CODE_ARTICLE_A",
                "CODE_ARTICLE_D",
                "CODE_ARTICLE_M",
                "CODE_ARTICLE_V",
                "CODE_ARTICLE_LO",
                "CODE_ARTICLE_LP",
                "CODE_ARTICLE_LR",
                "CODE_ARTICLE_LD",
                "CODE_ARTICLE_LM",
                "CODE_ARTICLE_LV",
                "CODE_ARTICLE_RO",
                "CODE_ARTICLE_RP",
                "CODE_ARTICLE_RR",
                "CODE_ARTICLE_RD",
                "CODE_ARTICLE_RM",
                "CODE_ARTICLE_RV",
                "CODE_ARTICLE_TO",
                "CODE_ARTICLE_TP",
                "CODE_ARTICLE_TR",
                "CODE_ARTICLE_TD",
                "CODE_ARTICLE_TM",
                "CODE_ARTICLE_TV",
                "CODE_ARTICLE_AO",
                "CODE_ARTICLE_AP",
                "CODE_ARTICLE_AR",
                "CODE_ARTICLE_AD",
                "CODE_ARTICLE_AM",
                "CODE_ARTICLE_AV",
                "CODE_ARTICLE_DO",
                "CODE_ARTICLE_DP",
                "CODE_ARTICLE_DR",
                "CODE_ARTICLE_DD",
                "CODE_ARTICLE_DM",
                "CODE_ARTICLE_DV",
                "CODE_ARTICLE_MO",
                "CODE_ARTICLE_MP",
                "CODE_ARTICLE_MR",
                "CODE_ARTICLE_MD",
                "CODE_ARTICLE_MM",
                "CODE_ARTICLE_MV",
                "CODE_ARTICLE_VO",
                "CODE_ARTICLE_VP",
                "CODE_ARTICLE_VR",
                "CODE_ARTICLE_VD",
                "CODE_ARTICLE_VM",
                "CODE_ARTICLE_VV",
            ]
            scope_params = "&".join([f"searchScope={scope}" for scope in article_scopes])
    
            # Code parameters
            codes = [
                "CGIAN2",
                "CGIAN3",
                "CGIAN4",
                "CGICT",
                "CGILEGIARTI000006308740",
                "CGIPENAL",
                "CGISUBDIV",
                "CGITM",
                "LEGITEXT000006069577",
            ]
            code_params = "&".join([f"code={code}" for code in codes])
    
            url = f"{SEARCH_URL}/code?{base_params}&{scope_params}&{code_params}"
    
            # Get the page
            response = await self.get_page(url)
    
            # Parse HTML
            soup = self.parse_html(response.text)
    
            # Extract search results
            search_results = self._extract_search_results(soup)
    
            return self.format_result(
                status="success",
                data={
                    "query": query,
                    "results": search_results,
                },
                message=f"Successfully searched for tax law articles with query: {query}",
                source_url=f"{BASE_URL}{url}",
            )
    
        except Exception as e:
            logger.error(f"Error searching tax law: {e}")
            return self.format_result(
                status="error",
                message=f"Failed to search tax law: {str(e)}",
                data={"query": query},
                error=e,
            )
  • Top-level helper function that delegates to the singleton LegalScraper instance's search_tax_law method. This is the entry point imported and called by the server.py wrapper.
    async def search_tax_law(query: str) -> Dict:
        """Search for tax law articles on legifrance.gouv.fr.
    
        Args:
            query: Search query
    
        Returns:
            Dictionary containing search results
        """
        return await legal_scraper.search_tax_law(query)
  • Singleton instance of LegalScraper used by top-level helper functions.
    legal_scraper = LegalScraper()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool searches for articles but doesn't describe what the search returns (e.g., list of results, full text, metadata), whether it's a read-only operation, any rate limits, authentication needs, or how results are formatted/paginated. This leaves significant gaps for an AI agent to understand the tool's behavior.

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?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with zero wasted content, making it easy for an AI agent to parse quickly.

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?

Given that there's an output schema (which should document return values), no annotations, and low schema coverage, the description is minimally adequate but incomplete. It specifies the source (legifrance.gouv.fr) but lacks details on behavior, parameters, and usage context that would help an AI agent invoke it correctly, especially compared to sibling tools.

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

Parameters2/5

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

Schema description coverage is 0%, meaning the schema provides no descriptions for the two parameters ('query' and 'ctx'). The description adds no information about what the 'query' parameter should contain (e.g., keywords, phrases, filters) or how the optional 'ctx' parameter is used. It fails to compensate for the lack of schema documentation, leaving parameters largely unexplained.

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 action ('Search for tax law articles') and the target resource/source ('on legifrance.gouv.fr'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from sibling tools like 'get_tax_article' or 'get_tax_info_from_web', which might have overlapping purposes.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to prefer this over siblings like 'get_tax_article' (which might retrieve specific articles) or 'get_tax_info_from_web' (which might search broader web sources), nor does it specify any prerequisites or exclusions for usage.

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

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