Tool utils
annotation_to_type_str(annotation)
Used to convert inspect annotations to type strings
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
annotation
|
Inspect annotation |
required |
Returns:
| Type | Description |
|---|---|
str
|
Type string |
Source code in blue/utils/tool_utils.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
convert_type_string_to_mcp(type_str)
Converts a type string to MCP format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type_str
|
str
|
Type string to convert |
required |
Returns:
| Type | Description |
|---|---|
dict
|
MCP format dictionary |
Source code in blue/utils/tool_utils.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
extract_signature(f, mcp_format=False)
Extracts the signature of a function and returns it as a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
callable
|
Function to extract signature from |
required |
mcp_format
|
bool
|
If True, converts types to MCP format. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary containing function parameters and return type. |
Source code in blue/utils/tool_utils.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
Last update: 2025-10-05