MCPcopy Create free account

hub / github.com/universal-tool-calling-protocol/code-mode / functions

Functions67 in github.com/universal-tool-calling-protocol/code-mode

↓ 15 callersMethodcallToolChain
* Executes TypeScript code with access to registered tools and captures console output. * The code can call tools directly as functions and has acc
typescript-library/src/code_mode_utcp_client.ts:178
↓ 10 callersMethod_map_json_type_to_python
Map basic JSON Schema types to Python types.
python-library/src/utcp_code_mode/code_mode_utcp_client.py:697
↓ 10 callersMethod_sanitize_identifier
Sanitize an identifier to be a valid Python identifier. Replaces any non-alphanumeric character (except underscore) with underscore
python-library/src/utcp_code_mode/code_mode_utcp_client.py:138
↓ 9 callersMethod_json_schema_to_python_type_string
Convert a JSON Schema to a Python type string (not a full type definition).
python-library/src/utcp_code_mode/code_mode_utcp_client.py:645
↓ 8 callersFunctioninitializeUtcpClient
()
code-mode-mcp/index.ts:215
↓ 7 callersMethodcall_tool_chain
REQUIRED Execute Python code with access to registered tools and capture console output. The code can call tools directly as
python-library/src/utcp_code_mode/code_mode_utcp_client.py:229
↓ 6 callersMethodsanitizeIdentifier
* Sanitizes an identifier to be a valid TypeScript identifier. * Replaces any non-alphanumeric character (except underscore) with underscore * a
typescript-library/src/code_mode_utcp_client.ts:93
↓ 5 callersMethodtoolToTypeScriptInterface
* Converts a Tool object into a TypeScript function interface string. * This generates the function signature that can be used in TypeScript code.
typescript-library/src/code_mode_utcp_client.ts:106
↓ 4 callersMethodcall_tool
(self, tool_name: str, tool_args: Dict[str, Any])
python-library/src/utcp_code_mode/code_mode_utcp_client.py:720
↓ 4 callersMethodjsonSchemaToTypeScriptType
* Converts a JSON Schema to a TypeScript type (not a full type definition).
typescript-library/src/code_mode_utcp_client.ts:453
↓ 4 callersMethodtool_to_python_interface
REQUIRED Convert a Tool object into a Python type hint interface string. This generates the function signature and type hints
python-library/src/utcp_code_mode/code_mode_utcp_client.py:156
↓ 3 callersMethodprimitiveSchemaToTypeScript
* Converts a primitive JSON Schema to TypeScript type with enum support.
typescript-library/src/code_mode_utcp_client.ts:439
↓ 2 callersMethod_create_execution_context
Create a secure execution context for running Python code. This context includes tool functions and safe Python globals with
python-library/src/utcp_code_mode/code_mode_utcp_client.py:381
↓ 2 callersMethod_create_restricted_import
Create a restricted import function that only allows safe modules. Note: 'time' module is included for timing functionality, though t
python-library/src/utcp_code_mode/code_mode_utcp_client.py:363
↓ 2 callersMethod_json_schema_to_python_type
Convert a JSON Schema to Python TypedDict class definition. This handles the most common JSON Schema patterns used in UTCP tools.
python-library/src/utcp_code_mode/code_mode_utcp_client.py:557
↓ 2 callersMethod_json_schema_to_typed_dict_content
Convert a JSON Schema to Python TypedDict content (properties only). This generates the content inside a TypedDict class definition.
python-library/src/utcp_code_mode/code_mode_utcp_client.py:521
↓ 2 callersMethodcreate
* Creates a new CodeModeUtcpClient instance. * This creates a regular UtcpClient and then upgrades it to a CodeModeUtcpClient * with all the sam
typescript-library/src/code_mode_utcp_client.ts:69
↓ 2 callersMethodgetAllToolsTypeScriptInterfaces
* Converts all registered tools to TypeScript interface definitions. * This provides the complete type definitions for all available tools. *
typescript-library/src/code_mode_utcp_client.ts:162
↓ 2 callersMethodget_all_tools_python_interfaces
REQUIRED Convert all registered tools to Python type hint definitions. This provides the complete type definitions for all av
python-library/src/utcp_code_mode/code_mode_utcp_client.py:211
↓ 2 callersMethodget_tools
Get all registered tools from the base client.
python-library/src/utcp_code_mode/code_mode_utcp_client.py:736
↓ 2 callersMethodjsonSchemaToObjectContent
* Converts a JSON Schema to TypeScript object content (properties only, no interface wrapper). * This generates the content inside an interface def
typescript-library/src/code_mode_utcp_client.ts:335
↓ 2 callersMethodjsonSchemaToTypeScript
* Converts a JSON Schema to TypeScript interface definition. * This handles the most common JSON Schema patterns used in UTCP tools. * * @pa
typescript-library/src/code_mode_utcp_client.ts:367
↓ 2 callersMethodmapJsonTypeToTS
* Maps basic JSON Schema types to TypeScript types.
typescript-library/src/code_mode_utcp_client.ts:503
↓ 1 callersMethod_array_schema_to_python_type
Convert an array JSON Schema to Python type alias.
python-library/src/utcp_code_mode/code_mode_utcp_client.py:615
↓ 1 callersMethod_execute_restricted_code
Execute the compiled restricted code in the given context. The code is wrapped in a function, so return statements work naturally.
python-library/src/utcp_code_mode/code_mode_utcp_client.py:318
↓ 1 callersMethod_object_schema_to_python_class
Convert an object JSON Schema to Python TypedDict class.
python-library/src/utcp_code_mode/code_mode_utcp_client.py:588
↓ 1 callersMethod_primitive_schema_to_python_type
Convert a primitive JSON Schema to Python type with enum support.
python-library/src/utcp_code_mode/code_mode_utcp_client.py:629
↓ 1 callersMethod_run_with_restricted_python
Run code with timeout support using RestrictedPython for secure execution. Args: code: Python code to execute
python-library/src/utcp_code_mode/code_mode_utcp_client.py:264
↓ 1 callersMethodarraySchemaToTypeScript
* Converts an array JSON Schema to TypeScript type.
typescript-library/src/code_mode_utcp_client.ts:424
↓ 1 callersMethodcreate
Create a new CodeModeUtcpClient instance. This creates a regular UtcpClient first and then wraps it with CodeModeUtcpClient f
python-library/src/utcp_code_mode/code_mode_utcp_client.py:114
↓ 1 callersMethodcreateExecutionContext
* Creates the execution context for running TypeScript code. * This context includes tool functions and basic JavaScript globals. * * @param
typescript-library/src/code_mode_utcp_client.ts:246
↓ 1 callersMethodderegister_manual
(self, manual_call_template_name: str)
python-library/src/utcp_code_mode/code_mode_utcp_client.py:717
↓ 1 callersMethodget_required_variables_for_manual_and_tools
(self, manual_call_template)
python-library/src/utcp_code_mode/code_mode_utcp_client.py:730
↓ 1 callersMethodget_required_variables_for_registered_tool
(self, tool_name: str)
python-library/src/utcp_code_mode/code_mode_utcp_client.py:733
↓ 1 callersFunctionmain
()
code-mode-mcp/index.ts:41
↓ 1 callersMethodobjectSchemaToTypeScript
* Converts an object JSON Schema to TypeScript interface.
typescript-library/src/code_mode_utcp_client.ts:400
↓ 1 callersMethodregister_manual
(self, manual_call_template)
python-library/src/utcp_code_mode/code_mode_utcp_client.py:711
↓ 1 callersMethodregister_manuals
(self, manual_call_templates)
python-library/src/utcp_code_mode/code_mode_utcp_client.py:714
↓ 1 callersMethodrunWithTimeout
* Runs code in VM context with timeout support. * * @param code Code to execute * @param context VM context * @param timeout Timeout in m
typescript-library/src/code_mode_utcp_client.ts:212
↓ 1 callersMethodsearch_tools
(self, query: str, limit: int = 10, any_of_tags_required: Optional[List[str]] = None)
python-library/src/utcp_code_mode/code_mode_utcp_client.py:727
↓ 1 callersFunctionsetupMcpTools
()
code-mode-mcp/index.ts:53
Method__init__
Initialize the CodeModeUtcpClient. Args: base_client: The base UtcpClient to wrap
python-library/src/utcp_code_mode/code_mode_utcp_client.py:104
Method__init__
(self, name="test", call_template_type="http")
python-library/tests/test_code_mode_utcp_client.py:17
Methodcall_tool_streaming
(self, tool_name: str, tool_args: Dict[str, Any])
python-library/src/utcp_code_mode/code_mode_utcp_client.py:723
Functioncode_mode_client
Create a CodeModeUtcpClient instance for testing.
python-library/tests/test_code_mode_utcp_client.py:47
Methodmake_tool_function
Create a tool function with proper closure to avoid late binding issues. The function is synchronous but internally blocks on
python-library/src/utcp_code_mode/code_mode_utcp_client.py:460
Functionmock_base_client
Create a mock base client for testing.
python-library/tests/test_code_mode_utcp_client.py:22
Methodprint_factory
Factory that returns our shared PrintCollector instance. Args: _getattr: Optional getattr function (Restricte
python-library/src/utcp_code_mode/code_mode_utcp_client.py:444
Methodrestricted_import
(name, *args, **kwargs)
python-library/src/utcp_code_mode/code_mode_utcp_client.py:374
Functionsample_tool
Create a sample tool for testing.
python-library/tests/test_code_mode_utcp_client.py:53
Methodtest_agent_prompt_template
Test that the agent prompt template is properly defined.
python-library/tests/test_code_mode_utcp_client.py:436
Methodtest_call_tool_chain_error_handling
Test error handling in code execution.
python-library/tests/test_code_mode_utcp_client.py:187
Methodtest_call_tool_chain_simple_execution
Test simple code execution without tools.
python-library/tests/test_code_mode_utcp_client.py:137
Methodtest_call_tool_chain_timeout
Test timeout handling. Note: Python can't forcibly kill threads running synchronous code, so infinite loops can't be interrup
python-library/tests/test_code_mode_utcp_client.py:208
Methodtest_call_tool_chain_with_tool_calls
Test code execution with tool calls.
python-library/tests/test_code_mode_utcp_client.py:159
Methodtest_create_class_method
Test the create class method.
python-library/tests/test_code_mode_utcp_client.py:407
Methodtest_create_execution_context
Test execution context creation.
python-library/tests/test_code_mode_utcp_client.py:242
Methodtest_create_restricted_import
Test RestrictedPython integration and safe globals.
python-library/tests/test_code_mode_utcp_client.py:421
Methodtest_delegation_methods
Test that all abstract methods are properly delegated.
python-library/tests/test_code_mode_utcp_client.py:324
Methodtest_get_all_tools_python_interfaces
Test getting all tool interfaces.
python-library/tests/test_code_mode_utcp_client.py:120
Methodtest_json_schema_to_python_type_string
Test JSON schema to Python type conversion.
python-library/tests/test_code_mode_utcp_client.py:274
Methodtest_map_json_type_to_python
Test basic type mapping.
python-library/tests/test_code_mode_utcp_client.py:312
Methodtest_restricted_builtins
Test that builtins are properly restricted.
python-library/tests/test_code_mode_utcp_client.py:387
Methodtest_restricted_imports
Test that dangerous imports are blocked.
python-library/tests/test_code_mode_utcp_client.py:354
Methodtest_sanitize_identifier
Test identifier sanitization.
python-library/tests/test_code_mode_utcp_client.py:85
Methodtest_tool_to_python_interface
Test converting tool to Python interface.
python-library/tests/test_code_mode_utcp_client.py:101
Methodtool_function
(args: Dict[str, Any] = None, **kwargs)
python-library/src/utcp_code_mode/code_mode_utcp_client.py:466