update_routing_code
Update an existing routing code in the PPF directory. Rename the value or change its label without recreating the entry.
Instructions
Partially update an existing routing code in the PPF directory (PATCH semantics).
Only the fields explicitly provided are modified; omitted fields keep their current values. Use to rename a routing code value or update its label without recreating it.
BEHAVIOR:
Returns the updated routing code object on success.
Fails with 404 if the instanceId does not exist.
Fails if the new routing_code value is already used by another routing code on the same SIRET (duplicate).
Updating routing_code renames it in-place; existing directory lines referencing it are updated automatically.
Providing neither routing_code nor label is a no-op (returns the unchanged object).
RESPONSE: the full updated routing code object — instanceId, siret, siren, routingCode, label, updatedAt.
USAGE GUIDELINES:
Retrieve the instanceId first via search_routing_code if you only know the routing code value.
Prefer updating the label for cosmetic changes; only change routing_code if the identifier itself must change (e.g. department renamed), since senders may have cached the old value.
To delete and replace a routing code entirely, use delete on the old instanceId and create_routing_code for the new one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance_id | Yes | Instance identifier of the routing code to update. Obtained from create_routing_code or search_routing_code response. Required — there is no lookup by routing_code value directly. | |
| routing_code | No | New routing code value (replaces the existing one). Must be unique for the associated SIRET. Omit to leave the current value unchanged. | |
| label | No | New descriptive label for the routing code. Omit to leave the current label unchanged. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools/directory_tools.py:452-513 (handler)The MCP tool handler for update_routing_code. Registers a @mcp.tool() async function that returns an error explaining the API was removed in XP Z12-013 v1.2.0; updates must be done via the Approved Platform portal.
@mcp.tool() async def update_routing_code( instance_id: Annotated[ str, Field( description=( "Instance identifier of the routing code to update. " "Obtained from create_routing_code or search_routing_code response. " "Required — there is no lookup by routing_code value directly." ) ), ], routing_code: Annotated[ Optional[str], Field( default=None, description=( "New routing code value (replaces the existing one). " "Must be unique for the associated SIRET. " "Omit to leave the current value unchanged." ), ), ] = None, label: Annotated[ Optional[str], Field( default=None, description=( "New descriptive label for the routing code. " "Omit to leave the current label unchanged." ), ), ] = None, ) -> dict: """ Partially update an existing routing code in the PPF directory (PATCH semantics). Only the fields explicitly provided are modified; omitted fields keep their current values. Use to rename a routing code value or update its label without recreating it. BEHAVIOR: - Returns the updated routing code object on success. - Fails with 404 if the instanceId does not exist. - Fails if the new routing_code value is already used by another routing code on the same SIRET (duplicate). - Updating routing_code renames it in-place; existing directory lines referencing it are updated automatically. - Providing neither routing_code nor label is a no-op (returns the unchanged object). RESPONSE: the full updated routing code object — instanceId, siret, siren, routingCode, label, updatedAt. USAGE GUIDELINES: - Retrieve the instanceId first via search_routing_code if you only know the routing code value. - Prefer updating the label for cosmetic changes; only change routing_code if the identifier itself must change (e.g. department renamed), since senders may have cached the old value. - To delete and replace a routing code entirely, use delete on the old instanceId and create_routing_code for the new one. """ return { "error": ( "update_routing_code is not available. " "PATCH /v1/routing-code/id-instance was removed in XP Z12-013 v1.2.0. " "Routing code updates must be performed through your Approved Platform portal." ) } - tools/directory_tools.py:452-506 (schema)Input schema for update_routing_code defined via Pydantic Field annotations: instance_id (required string), routing_code (optional string), label (optional string).
@mcp.tool() async def update_routing_code( instance_id: Annotated[ str, Field( description=( "Instance identifier of the routing code to update. " "Obtained from create_routing_code or search_routing_code response. " "Required — there is no lookup by routing_code value directly." ) ), ], routing_code: Annotated[ Optional[str], Field( default=None, description=( "New routing code value (replaces the existing one). " "Must be unique for the associated SIRET. " "Omit to leave the current value unchanged." ), ), ] = None, label: Annotated[ Optional[str], Field( default=None, description=( "New descriptive label for the routing code. " "Omit to leave the current label unchanged." ), ), ] = None, ) -> dict: """ Partially update an existing routing code in the PPF directory (PATCH semantics). Only the fields explicitly provided are modified; omitted fields keep their current values. Use to rename a routing code value or update its label without recreating it. BEHAVIOR: - Returns the updated routing code object on success. - Fails with 404 if the instanceId does not exist. - Fails if the new routing_code value is already used by another routing code on the same SIRET (duplicate). - Updating routing_code renames it in-place; existing directory lines referencing it are updated automatically. - Providing neither routing_code nor label is a no-op (returns the unchanged object). RESPONSE: the full updated routing code object — instanceId, siret, siren, routingCode, label, updatedAt. USAGE GUIDELINES: - Retrieve the instanceId first via search_routing_code if you only know the routing code value. - Prefer updating the label for cosmetic changes; only change routing_code if the identifier itself must change (e.g. department renamed), since senders may have cached the old value. - To delete and replace a routing code entirely, use delete on the old instanceId and create_routing_code for the new one. """ - tools/directory_tools.py:70-70 (registration)The register_directory_tools() function decorates all directory tool handlers including update_routing_code with @mcp.tool().
def register_directory_tools(mcp: FastMCP) -> None: - clients/directory_client.py:150-160 (helper)Client-level helper method for update_routing_code. Raises NotImplementedError because the underlying API endpoint was removed.
async def update_routing_code( self, instance_id: str, routing_code: Optional[str] = None, label: Optional[str] = None, ) -> dict[str, Any]: """PATCH /v1/routing-code/id-instance:{id} — REMOVED in XP Z12-013 v1.2.0.""" raise NotImplementedError( "PATCH /v1/routing-code/id-instance was removed in XP Z12-013 v1.2.0. " "Routing code updates are now managed through the Approved Platform portal." )