Skip to content

Argument models do not constrain entity_id #27

Description

@bburda

Summary

The gateway rejects an entity id that is empty, longer than 256 characters, or contains anything other than letters, digits, underscore and hyphen. The Pydantic argument models in models.py declare entity_id as a plain str with no constraint, so all of those are accepted locally and sent to the gateway.

Nothing is broken today, because the gateway validates. The cost is a round trip that could be avoided, and an error message that comes from the gateway instead of from the tool. An id containing a slash is worse than a plain rejection, because it changes the shape of the request path.


Proposed solution (optional)

Add one shared constrained string type for entity ids and use it in every argument model that takes one. Applying it to a single tool would leave the models inconsistent, so this should be done in one pass.


Additional context (optional)

The gateway rule is in validate_entity_id in ros2_medkit_gateway: not empty, at most 256 characters, alphanumeric plus underscore and hyphen.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions