Skip to main content
Glama
cmendezs

mcp-facture-electronique-fr

search_company

Find French companies registered for e-invoicing by name, SIREN, or status. Returns SIREN, name, and registration details to enable invoice routing.

Instructions

Search for companies (legal units / SIRENs) in the PPF directory by criteria.

Returns VAT-registered French legal units recorded in the PPF directory. A company must appear here before its establishments (SIRETs) or directory lines can be used.

BEHAVIOR:

  • Returns a paginated list of matching companies; empty list if none match.

  • At least one search criterion must be provided; omitting all returns an error.

  • Name search is a partial, case-insensitive match against the legal name and trade name.

  • Pagination: if the response contains 'nextUpdatedAfter', pass it as updated_after to get the next page.

RESPONSE: each item includes siren, name, status (Active/Inactive/Pending), approvedPlatformId, and timestamps (createdAt, updatedAt).

USAGE GUIDELINES:

  • Prefer get_company_by_siren when you already know the exact SIREN (faster, direct lookup).

  • Use search_company with name to resolve a company name to its SIREN before further lookups.

  • Always check status == Active before attempting to send invoices to or look up establishments for a company.

  • A company not present in the directory is not yet registered for e-invoicing; invoices cannot be routed to it.

  • After finding the SIREN, call search_establishment or get_directory_line to find the recipient's address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoCompany name or trade name (partial match accepted). Example: 'Dupont' returns all entities whose name contains 'Dupont'. Use when you know the name but not the SIREN.
sirenNoCompany SIREN number (9 digits, no spaces). Example: '123456789'. Use for an exact lookup; prefer get_company_by_siren when the SIREN is known.
statusNoRegistration status of the legal unit in the PPF directory. Active: registered and reachable for e-invoicing. Inactive: deregistered; cannot receive invoices. Pending: registration in progress.
updated_afterNoPagination cursor: only return entries updated after this date/time (ISO 8601, e.g. 2024-09-01T00:00:00Z). Use the 'nextUpdatedAfter' field from the previous response to fetch the next page.
limitNoMaximum number of results per page (1-500, default 50).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'search_company'. It is a FastMCP tool (registered via @mcp.tool() decorator) that accepts optional filters: name, siren, status, updated_after, and limit. It delegates to the DirectoryClient.search_company method.
    async def search_company(
        name: Annotated[
            Optional[str],
            Field(
                default=None,
                description=(
                    "Company name or trade name (partial match accepted). "
                    "Example: 'Dupont' returns all entities whose name contains 'Dupont'. "
                    "Use when you know the name but not the SIREN."
                ),
            ),
        ] = None,
        siren: Annotated[
            Optional[str],
            Field(
                default=None,
                description=(
                    "Company SIREN number (9 digits, no spaces). "
                    "Example: '123456789'. "
                    "Use for an exact lookup; prefer get_company_by_siren when the SIREN is known."
                ),
            ),
        ] = None,
        status: Annotated[
            Optional[str],
            Field(
                default=None,
                description=(
                    "Registration status of the legal unit in the PPF directory. "
                    "Active: registered and reachable for e-invoicing. "
                    "Inactive: deregistered; cannot receive invoices. "
                    "Pending: registration in progress."
                ),
            ),
        ] = None,
        updated_after: Annotated[
            Optional[str],
            Field(
                default=None,
                description=(
                    "Pagination cursor: only return entries updated after this date/time "
                    "(ISO 8601, e.g. 2024-09-01T00:00:00Z). "
                    "Use the 'nextUpdatedAfter' field from the previous response to fetch the next page."
                ),
            ),
        ] = None,
        limit: Annotated[
            int,
            Field(default=50, ge=1, le=500, description="Maximum number of results per page (1-500, default 50)."),
        ] = 50,
    ) -> dict:
        """
        Search for companies (legal units / SIRENs) in the PPF directory by criteria.
    
        Returns VAT-registered French legal units recorded in the PPF directory.
        A company must appear here before its establishments (SIRETs) or directory lines can be used.
    
        BEHAVIOR:
        - Returns a paginated list of matching companies; empty list if none match.
        - At least one search criterion must be provided; omitting all returns an error.
        - Name search is a partial, case-insensitive match against the legal name and trade name.
        - Pagination: if the response contains 'nextUpdatedAfter', pass it as updated_after to get the next page.
    
        RESPONSE: each item includes siren, name, status (Active/Inactive/Pending),
        approvedPlatformId, and timestamps (createdAt, updatedAt).
    
        USAGE GUIDELINES:
        - Prefer get_company_by_siren when you already know the exact SIREN (faster, direct lookup).
        - Use search_company with name to resolve a company name to its SIREN before further lookups.
        - Always check status == Active before attempting to send invoices to or look up establishments for a company.
        - A company not present in the directory is not yet registered for e-invoicing; invoices cannot be routed to it.
        - After finding the SIREN, call search_establishment or get_directory_line to find the recipient's address.
        """
        client = get_directory_client()
        return await client.search_company(
            name=name,
            siren=siren,
            status=status,
            updated_after=updated_after,
            limit=limit,
        )
  • The HTTP client method that performs the actual API call. Sends a POST request to /v1/siren/search with the provided filter parameters and returns the JSON response.
    async def search_company(
        self,
        name: Optional[str] = None,
        siren: Optional[str] = None,
        status: Optional[str] = None,
        updated_after: Optional[str] = None,
        limit: int = 50,
    ) -> dict[str, Any]:
        """POST /v1/siren/search — Search legal units in the PPF directory."""
        body: dict[str, Any] = {"limit": limit}
        if name:
            body["name"] = name
        if siren:
            body["siren"] = siren
        if status:
            body["status"] = status
        if updated_after:
            body["updatedAfter"] = updated_after
        response = await self._request("POST", "/v1/siren/search", json=body)
        return response.json()
  • The register_directory_tools function registers all directory tools on the FastMCP instance. The 'search_company' tool is defined and registered via @mcp.tool() decorator inside this function (lines 38-119).
    def register_directory_tools(mcp: FastMCP) -> None:
        """Registers the 12 Directory Service tools on the FastMCP instance."""
    
        # ------------------------------------------------------------------
        # SIREN — Legal units
        # ------------------------------------------------------------------
    
        @mcp.tool()
        async def search_company(
            name: Annotated[
                Optional[str],
                Field(
                    default=None,
                    description=(
                        "Company name or trade name (partial match accepted). "
                        "Example: 'Dupont' returns all entities whose name contains 'Dupont'. "
                        "Use when you know the name but not the SIREN."
                    ),
                ),
            ] = None,
            siren: Annotated[
                Optional[str],
                Field(
                    default=None,
                    description=(
                        "Company SIREN number (9 digits, no spaces). "
                        "Example: '123456789'. "
                        "Use for an exact lookup; prefer get_company_by_siren when the SIREN is known."
                    ),
                ),
            ] = None,
            status: Annotated[
                Optional[str],
                Field(
                    default=None,
                    description=(
                        "Registration status of the legal unit in the PPF directory. "
                        "Active: registered and reachable for e-invoicing. "
                        "Inactive: deregistered; cannot receive invoices. "
                        "Pending: registration in progress."
                    ),
                ),
            ] = None,
            updated_after: Annotated[
                Optional[str],
                Field(
                    default=None,
                    description=(
                        "Pagination cursor: only return entries updated after this date/time "
                        "(ISO 8601, e.g. 2024-09-01T00:00:00Z). "
                        "Use the 'nextUpdatedAfter' field from the previous response to fetch the next page."
                    ),
                ),
            ] = None,
            limit: Annotated[
                int,
                Field(default=50, ge=1, le=500, description="Maximum number of results per page (1-500, default 50)."),
            ] = 50,
        ) -> dict:
            """
            Search for companies (legal units / SIRENs) in the PPF directory by criteria.
    
            Returns VAT-registered French legal units recorded in the PPF directory.
            A company must appear here before its establishments (SIRETs) or directory lines can be used.
    
            BEHAVIOR:
            - Returns a paginated list of matching companies; empty list if none match.
            - At least one search criterion must be provided; omitting all returns an error.
            - Name search is a partial, case-insensitive match against the legal name and trade name.
            - Pagination: if the response contains 'nextUpdatedAfter', pass it as updated_after to get the next page.
    
            RESPONSE: each item includes siren, name, status (Active/Inactive/Pending),
            approvedPlatformId, and timestamps (createdAt, updatedAt).
    
            USAGE GUIDELINES:
            - Prefer get_company_by_siren when you already know the exact SIREN (faster, direct lookup).
            - Use search_company with name to resolve a company name to its SIREN before further lookups.
            - Always check status == Active before attempting to send invoices to or look up establishments for a company.
            - A company not present in the directory is not yet registered for e-invoicing; invoices cannot be routed to it.
            - After finding the SIREN, call search_establishment or get_directory_line to find the recipient's address.
            """
            client = get_directory_client()
            return await client.search_company(
                name=name,
                siren=siren,
                status=status,
                updated_after=updated_after,
                limit=limit,
            )
  • server.py:63-64 (registration)
    Top-level registration: register_directory_tools(mcp) is called in server.py to register all directory tools including 'search_company'.
    register_flow_tools(mcp)
    register_directory_tools(mcp)
  • Input schema for search_company defined via Pydantic Field annotations on the function parameters: name (optional str), siren (optional str), status (optional str), updated_after (optional str), limit (int, default=50, range 1-500).
    async def search_company(
        name: Annotated[
            Optional[str],
            Field(
                default=None,
                description=(
                    "Company name or trade name (partial match accepted). "
                    "Example: 'Dupont' returns all entities whose name contains 'Dupont'. "
                    "Use when you know the name but not the SIREN."
                ),
            ),
        ] = None,
        siren: Annotated[
            Optional[str],
            Field(
                default=None,
                description=(
                    "Company SIREN number (9 digits, no spaces). "
                    "Example: '123456789'. "
                    "Use for an exact lookup; prefer get_company_by_siren when the SIREN is known."
                ),
            ),
        ] = None,
        status: Annotated[
            Optional[str],
            Field(
                default=None,
                description=(
                    "Registration status of the legal unit in the PPF directory. "
                    "Active: registered and reachable for e-invoicing. "
                    "Inactive: deregistered; cannot receive invoices. "
                    "Pending: registration in progress."
                ),
            ),
        ] = None,
        updated_after: Annotated[
            Optional[str],
            Field(
                default=None,
                description=(
                    "Pagination cursor: only return entries updated after this date/time "
                    "(ISO 8601, e.g. 2024-09-01T00:00:00Z). "
                    "Use the 'nextUpdatedAfter' field from the previous response to fetch the next page."
                ),
            ),
        ] = None,
        limit: Annotated[
            int,
            Field(default=50, ge=1, le=500, description="Maximum number of results per page (1-500, default 50)."),
        ] = 50,
    ) -> dict:
Behavior5/5

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

With no annotations, the description fully discloses behavior: returns paginated list, empty if none match, error if no criteria, partial case-insensitive name search, pagination via updated_after, and response structure. It also clarifies prerequisites for other tools.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with clear sections (BEHAVIOR, RESPONSE, USAGE GUIDELINES) and front-loaded purpose. Slightly verbose but each section adds unique value. Could be more concise, but still efficient.

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?

Fully covers the tool's complexity: multiple optional parameters, pagination, prerequisite (company must exist), status interpretation, and integration with sibling tools. Output schema is implied and response fields are listed, sufficient for agent comprehension.

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

Parameters4/5

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

Schema coverage is 100% with detailed parameter descriptions. The description adds value beyond the schema by explaining the pagination cursor flow (nextUpdatedAfter → updated_after) and the requirement of at least one criterion. This is above the baseline 3.

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 it searches for companies (legal units/SIRENs) in the PPF directory by criteria. It distinguishes itself from the sibling 'get_company_by_siren' by specifying this is for searching when the SIREN is not known, making the purpose unambiguous.

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

Usage Guidelines5/5

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

Provides explicit when-to-use and when-not-to-use guidelines: prefer get_company_by_siren when SIREN known, requires at least one search criterion, and advises checking status before further actions. Also explains consequences (company must exist before establishments can be used).

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