get_company_by_siren
Retrieve company details and registration status from the PPF directory using a SIREN number.
Instructions
Look up a company in the PPF directory by its SIREN number. Returns the full legal unit information: company name, administrative status, associated Approved Platform, and registration dates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siren | Yes | Company SIREN number (9 digits, no spaces). Example: '123456789'. Returns the full legal unit information in the PPF directory, including registration status and Approved Platform. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools/directory_tools.py:165-189 (handler)The MCP tool handler for get_company_by_siren. Decorated with @mcp.tool(), it validates the SIREN input using _validate_siren (Luhn check), then delegates to DirectoryClient.get_company_by_siren for the actual HTTP GET /v1/siren/code-insee:{siren} call.
@mcp.tool() async def get_company_by_siren( siren: Annotated[ str, Field( description=( "Company SIREN number (9 digits, no spaces). " "Example: '123456789'. " "Returns the full legal unit information in the PPF directory, " "including registration status and Approved Platform." ) ), ], ) -> dict: """ Look up a company in the PPF directory by its SIREN number. Returns the full legal unit information: company name, administrative status, associated Approved Platform, and registration dates. """ try: siren = _validate_siren(siren) except ValueError as exc: return {"error": str(exc)} client = get_directory_client() return await client.get_company_by_siren(siren=siren) - tools/directory_tools.py:166-178 (schema)The input schema for the tool: a single required 'siren' parameter (Annotated[str, ...]) with Pydantic Field describing it as a 9-digit company SIREN number. The return type is dict.
async def get_company_by_siren( siren: Annotated[ str, Field( description=( "Company SIREN number (9 digits, no spaces). " "Example: '123456789'. " "Returns the full legal unit information in the PPF directory, " "including registration status and Approved Platform." ) ), ], ) -> dict: - tools/directory_tools.py:70-76 (registration)Registration function register_directory_tools(mcp) is called from server.py line 76. The tool is registered via the @mcp.tool() decorator at line 77 inside this function.
def register_directory_tools(mcp: FastMCP) -> None: """Registers the 12 Directory Service tools on the FastMCP instance.""" # ------------------------------------------------------------------ # SIREN — Legal units # ------------------------------------------------------------------ - tools/directory_tools.py:41-48 (helper)Helper function _validate_siren that validates the SIREN: ensures it is 9 numeric digits and passes the Luhn check digit validation.
def _validate_siren(value: str) -> str: """Return the stripped SIREN or raise ValueError if invalid.""" v = value.strip() if not v.isdigit() or len(v) != 9: raise ValueError(f"SIREN must be exactly 9 digits, got {value!r}") if not _luhn_ok(v): raise ValueError(f"SIREN {value!r} fails Luhn check digit validation") return v