kodeagent.kutils.build_tool_schema#

kodeagent.kutils.build_tool_schema(fn: Callable, just_first_line: bool = False, as_text: bool = True) dict[str, Any] | str[source]#

Auto-generate an OpenAI-style tool schema from a Python function.

Parameters:
  • fn – The function to build a tool schema for.

  • just_first_line – Whether to use only the first line of the docstring for the description.

  • as_text – Whether to return the schema as a formatted text instead of a dictionary.

Returns:

A dictionary representing the tool schema. Or a formatted text if as_text is True.