Skip to main content
Glama
cmendezs

mcp-facture-electronique-fr

get_establishment_by_siret

Look up an establishment in the PPF directory using its SIRET number to verify the receiving address before sending an invoice. Returns establishment details, status, and Approved Platform.

Instructions

Look up an establishment in the PPF directory by its SIRET number. Essential for verifying the receiving address before sending an invoice. Returns the establishment details, its status, and its Approved Platform.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siretYesEstablishment SIRET number (14 digits, no spaces). Example: '12345678900012'. Essential for verifying the receiving address before sending an invoice: confirms the establishment is registered and active in the PPF directory.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for get_establishment_by_siret. Decorated with @mcp.tool() via register_directory_tools. Validates the SIRET input (14 digits, Luhn check), then delegates to DirectoryClient.get_establishment_by_siret which makes a GET /v1/siret/code-insee:{siret} HTTP request.
    @mcp.tool()
    async def get_establishment_by_siret(
        siret: Annotated[
            str,
            Field(
                description=(
                    "Establishment SIRET number (14 digits, no spaces). "
                    "Example: '12345678900012'. "
                    "Essential for verifying the receiving address before sending an invoice: "
                    "confirms the establishment is registered and active in the PPF directory."
                )
            ),
        ],
    ) -> dict:
        """
        Look up an establishment in the PPF directory by its SIRET number.
        Essential for verifying the receiving address before sending an invoice.
        Returns the establishment details, its status, and its Approved Platform.
        """
        try:
            siret = _validate_siret(siret)
        except ValueError as exc:
            return {"error": str(exc)}
        client = get_directory_client()
        return await client.get_establishment_by_siret(siret=siret)
  • SIRET validation helper used by get_establishment_by_siret handler. Ensures the input is exactly 14 digits and passes Luhn check digit validation.
    def _validate_siret(value: str) -> str:
        """Return the stripped SIRET or raise ValueError if invalid."""
        v = value.strip()
        if not v.isdigit() or len(v) != 14:
            raise ValueError(f"SIRET must be exactly 14 digits, got {value!r}")
        if not _luhn_ok(v):
            raise ValueError(f"SIRET {value!r} fails Luhn check digit validation")
        return v
  • HTTP client method that executes the actual API call for get_establishment_by_siret. Sends a GET request to /v1/siret/code-insee:{siret} and returns the JSON response containing establishment details.
    async def get_establishment_by_siret(self, siret: str) -> dict[str, Any]:
        """GET /v1/siret/code-insee:{siret} — Look up an establishment by SIRET."""
        response = await self._request("GET", f"/v1/siret/code-insee:{siret}")
        return response.json()
  • Registration function that registers all directory tools on the FastMCP instance. The get_establishment_by_siret handler is registered via @mcp.tool() decorator within this function.
    def register_directory_tools(mcp: FastMCP) -> None:
        """Registers the 12 Directory Service tools on the FastMCP instance."""
    
        # ------------------------------------------------------------------
        # SIREN — Legal units
        # ------------------------------------------------------------------
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It indicates the tool is a read operation (look up) and what is returned, but it does not explicitly state that it is non-destructive, mention any required permissions, or disclose other behavioral traits like rate limits. The description is adequate but lacks depth beyond purpose.

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 consists of three concise, front-loaded sentences. The first sentence states the core action, the second provides context, and the third lists output. Every sentence adds value without redundancy, achieving optimal conciseness for a simple tool.

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

Completeness5/5

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

Given the tool's simplicity (one parameter, output schema exists), the description is complete. It covers purpose, usage context, and return contents. Since an output schema is present, it does not need to detail return values. No critical information is missing for correct use.

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%; the schema already provides detailed parameter information including format, example, and usage context. The tool description adds marginal value by restating the purpose but does not deepen understanding of the parameter beyond what the schema offers. Baseline of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the verb 'Look up an establishment' and the resource 'PPF directory by its SIRET number.' It distinguishes itself from sibling tools like 'search_establishment' by specifying a direct lookup via SIRET. Additionally, it mentions the return content (details, status, Approved Platform), making the tool's function unambiguous.

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

Usage Guidelines4/5

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

The description provides explicit context: 'Essential for verifying the receiving address before sending an invoice.' This helps the agent understand when to use the tool. However, it does not explicitly state when not to use it or mention alternatives like 'search_establishment' for cases without a SIRET, which would fully clarify usage boundaries.

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/cmendezs/mcp-facture-electronique-fr'

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