Skip to main content
Glama
cmendezs

mcp-facture-electronique-fr

search_company

Search for French companies in the PPF e-invoicing directory by name, SIREN, or status to find active legal units for 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

  • MCP tool handler for search_company: decorated with @mcp.tool(), defines schema (name, siren, status, updated_after, limit), validates SIREN if provided, calls DirectoryClient.search_company(), and returns the result.
    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.
        """
        if siren is not None:
            try:
                siren = _validate_siren(siren)
            except ValueError as exc:
                return {"error": str(exc)}
        client = get_directory_client()
        return await client.search_company(
            name=name,
            siren=siren,
            status=status,
            updated_after=updated_after,
            limit=limit,
        )
  • Input schema for search_company defined via Pydantic Field annotations: name (Optional[str], partial match), siren (Optional[str], 9 digits), status (Optional[str], Active/Inactive/Pending), updated_after (Optional[str], ISO 8601 cursor), limit (int, 1-500, default 50).
    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:
  • DirectoryClient.search_company() — the actual HTTP client method that POSTs to /v1/siren/search with the filter criteria and returns 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)
        if response.status_code == 204:
            return {"total": 0}
        return response.json()
  • Tool registration: search_company is registered inside register_directory_tools() using the @mcp.tool() decorator.
    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.
            """
            if siren is not None:
                try:
                    siren = _validate_siren(siren)
                except ValueError as exc:
                    return {"error": str(exc)}
            client = get_directory_client()
            return await client.search_company(
                name=name,
                siren=siren,
                status=status,
                updated_after=updated_after,
                limit=limit,
            )
Behavior5/5

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

No annotations provided, but description fully covers pagination (nextUpdatedAfter), empty result handling, error on missing criteria, partial case-insensitive name match, response fields, and prerequisite that company must exist before using establishments.

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-organized into sections (BEHAVIOR, USAGE GUIDELINES) and front-loaded with core purpose. Slightly verbose but every sentence adds value; could be tightened slightly.

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 output schema exists (not shown), description still lists response fields and explains pagination, prerequisite for establishment lookups, and e-invoicing context. Completely covers what an agent needs to use and interpret results.

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?

Input schema has 100% description coverage with examples, so baseline is 3. Description adds overall context like 'at least one criterion required' and pagination flow, providing moderate extra value.

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?

Explicitly states it searches for companies in PPF directory by criteria, returns VAT-registered French legal units. Clearly distinguishes from sibling get_company_by_siren by recommending exact SIREN lookup for that tool.

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 (name resolution), when-not-to (prefer get_company_by_siren), and alternatives (search_establishment, get_directory_line after finding SIREN). Also states required criteria and pagination handling.

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