Feature/tool group (#484)

* Tech spec for tool group

* Partial tool group implementation

* Tool group tests
This commit is contained in:
cybermaggedon 2025-09-03 23:39:49 +01:00 committed by GitHub
parent 672e358b2f
commit e74eb5d1ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 1304 additions and 6 deletions

View file

@ -63,6 +63,9 @@ def set_tool(
collection : str,
template : str,
arguments : List[Argument],
group : List[str],
state : str,
applicable_states : List[str],
):
api = Api(url).config()
@ -93,6 +96,12 @@ def set_tool(
for a in arguments
]
if group: object["group"] = group
if state: object["state"] = state
if applicable_states: object["applicable-states"] = applicable_states
values = api.put([
ConfigValue(
type="tool", key=f"{id}", value=json.dumps(object)
@ -179,6 +188,23 @@ def main():
help=f'Tool arguments in the form: name:type:description (can specify multiple)',
)
parser.add_argument(
'--group',
nargs="*",
help=f'Tool groups (e.g., read-only, knowledge, admin)',
)
parser.add_argument(
'--state',
help=f'State to transition to after successful execution',
)
parser.add_argument(
'--applicable-states',
nargs="*",
help=f'States in which this tool is available',
)
args = parser.parse_args()
try:
@ -219,6 +245,9 @@ def main():
collection=args.collection,
template=args.template,
arguments=arguments,
group=args.group or [],
state=args.state,
applicable_states=getattr(args, 'applicable_states', None) or [],
)
except Exception as e: