From 8f34e725e8124fa29d9d719dec9a1e3b2836ccf6 Mon Sep 17 00:00:00 2001 From: rahulpinto19 Date: Mon, 16 Mar 2026 18:33:48 +0000 Subject: [PATCH 1/2] fix: improve func_docstring --- packages/toolbox-core/src/toolbox_core/utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/toolbox-core/src/toolbox_core/utils.py b/packages/toolbox-core/src/toolbox_core/utils.py index 00c001572..b8686fada 100644 --- a/packages/toolbox-core/src/toolbox_core/utils.py +++ b/packages/toolbox-core/src/toolbox_core/utils.py @@ -34,13 +34,19 @@ def create_func_docstring(description: str, params: Sequence[ParameterSchema]) -> str: """Convert tool description and params into its function docstring""" - docstring = description + docstring = description.rstrip() + if not params: return docstring + docstring += "\n\nArgs:" + for p in params: annotation = p.to_param().annotation - docstring += f"\n {p.name} ({getattr(annotation, '__name__', str(annotation))}): {p.description}" + + param_desc = p.description.strip() if p.description else "" + + docstring += f"\n {p.name} ({getattr(annotation, '__name__', str(annotation))}): {param_desc}" return docstring From 4adc5fbde2e65709ad78a92303c49b07f3e9b22d Mon Sep 17 00:00:00 2001 From: rahulpinto19 Date: Mon, 16 Mar 2026 19:22:59 +0000 Subject: [PATCH 2/2] file format --- packages/toolbox-core/src/toolbox_core/utils.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/toolbox-core/src/toolbox_core/utils.py b/packages/toolbox-core/src/toolbox_core/utils.py index b8686fada..045d0c989 100644 --- a/packages/toolbox-core/src/toolbox_core/utils.py +++ b/packages/toolbox-core/src/toolbox_core/utils.py @@ -35,17 +35,17 @@ def create_func_docstring(description: str, params: Sequence[ParameterSchema]) -> str: """Convert tool description and params into its function docstring""" docstring = description.rstrip() - + if not params: return docstring - + docstring += "\n\nArgs:" - + for p in params: annotation = p.to_param().annotation param_desc = p.description.strip() if p.description else "" - + docstring += f"\n {p.name} ({getattr(annotation, '__name__', str(annotation))}): {param_desc}" return docstring @@ -94,7 +94,6 @@ def identify_auth_requirements( # find which of the required authn params are covered by available services. for param, services in req_authn_params.items(): - # if we don't have a token_getter for any of the services required by the param, # the param is still required matched_authn_services = [s for s in services if s in auth_service_names] @@ -125,7 +124,6 @@ def params_to_pydantic_model( """Converts the given parameters to a Pydantic BaseModel class.""" field_definitions = {} for field in params: - # Determine the default value based on the 'required' flag and the 'default' field. # '...' (Ellipsis) signifies a required field in Pydantic. # If a default value is provided in the schema, it should be used.