@@ -39,16 +39,17 @@ def test_empty_mcp_tools_list():
3939
4040def test_unknown_field_conversion ():
4141 """Test conversion of MCP tools with unknown fields to Gemini tools."""
42+ inputSchema = {
43+ 'type' : 'object' ,
44+ 'properties' : {},
45+ 'unknown_field' : 'unknownField' ,
46+ 'unknown_object' : {},
47+ }
4248 mcp_tools = [
4349 mcp_types .Tool (
4450 name = 'tool' ,
4551 description = 'tool-description' ,
46- inputSchema = {
47- 'type' : 'object' ,
48- 'properties' : {},
49- 'unknown_field' : 'unknownField' ,
50- 'unknown_object' : {},
51- },
52+ inputSchema = inputSchema ,
5253 ),
5354 ]
5455 result = _mcp_utils .mcp_to_gemini_tools (mcp_tools )
@@ -58,10 +59,7 @@ def test_unknown_field_conversion():
5859 types .FunctionDeclaration (
5960 name = 'tool' ,
6061 description = 'tool-description' ,
61- parameters = types .Schema (
62- type = 'OBJECT' ,
63- properties = {},
64- ),
62+ parameters_json_schema = inputSchema ,
6563 ),
6664 ],
6765 ),
@@ -70,24 +68,25 @@ def test_unknown_field_conversion():
7068
7169def test_items_conversion ():
7270 """Test conversion of MCP tools with items to Gemini tools."""
71+ inputSchema = {
72+ 'type' : 'array' ,
73+ 'items' : {
74+ 'type' : 'object' ,
75+ 'properties' : {
76+ 'key1' : {
77+ 'type' : 'string' ,
78+ },
79+ 'key2' : {
80+ 'type' : 'number' ,
81+ },
82+ },
83+ },
84+ }
7385 mcp_tools = [
7486 mcp_types .Tool (
7587 name = 'tool' ,
7688 description = 'tool-description' ,
77- inputSchema = {
78- 'type' : 'array' ,
79- 'items' : {
80- 'type' : 'object' ,
81- 'properties' : {
82- 'key1' : {
83- 'type' : 'string' ,
84- },
85- 'key2' : {
86- 'type' : 'number' ,
87- },
88- },
89- },
90- },
89+ inputSchema = inputSchema ,
9190 ),
9291 ]
9392 result = _mcp_utils .mcp_to_gemini_tools (mcp_tools )
@@ -97,16 +96,7 @@ def test_items_conversion():
9796 types .FunctionDeclaration (
9897 name = 'tool' ,
9998 description = 'tool-description' ,
100- parameters = types .Schema (
101- type = 'ARRAY' ,
102- items = types .Schema (
103- type = 'OBJECT' ,
104- properties = {
105- 'key1' : types .Schema (type = 'STRING' ),
106- 'key2' : types .Schema (type = 'NUMBER' ),
107- },
108- ),
109- ),
99+ parameters_json_schema = inputSchema ,
110100 ),
111101 ],
112102 ),
@@ -115,21 +105,24 @@ def test_items_conversion():
115105
116106def test_any_of_conversion ():
117107 """Test conversion of MCP tools with any_of to Gemini tools."""
108+
109+ inputSchema = {
110+ 'type' : 'object' ,
111+ 'any_of' : [
112+ {
113+ 'type' : 'string' ,
114+ },
115+ {
116+ 'type' : 'number' ,
117+ },
118+ ],
119+ }
120+
118121 mcp_tools = [
119122 mcp_types .Tool (
120123 name = 'tool' ,
121124 description = 'tool-description' ,
122- inputSchema = {
123- 'type' : 'object' ,
124- 'any_of' : [
125- {
126- 'type' : 'string' ,
127- },
128- {
129- 'type' : 'number' ,
130- },
131- ],
132- },
125+ inputSchema = inputSchema ,
133126 ),
134127 ]
135128 result = _mcp_utils .mcp_to_gemini_tools (mcp_tools )
@@ -139,13 +132,7 @@ def test_any_of_conversion():
139132 types .FunctionDeclaration (
140133 name = 'tool' ,
141134 description = 'tool-description' ,
142- parameters = types .Schema (
143- type = 'OBJECT' ,
144- any_of = [
145- types .Schema (type = 'STRING' ),
146- types .Schema (type = 'NUMBER' ),
147- ],
148- ),
135+ parameters_json_schema = inputSchema ,
149136 ),
150137 ],
151138 ),
@@ -154,21 +141,22 @@ def test_any_of_conversion():
154141
155142def test_properties_conversion ():
156143 """Test conversion of MCP tools with properties to Gemini tools."""
144+ inputSchema = {
145+ 'type' : 'object' ,
146+ 'properties' : {
147+ 'key1' : {
148+ 'type' : 'string' ,
149+ },
150+ 'key2' : {
151+ 'type' : 'number' ,
152+ },
153+ },
154+ }
157155 mcp_tools = [
158156 mcp_types .Tool (
159157 name = 'tool' ,
160158 description = 'tool-description' ,
161- inputSchema = {
162- 'type' : 'object' ,
163- 'properties' : {
164- 'key1' : {
165- 'type' : 'string' ,
166- },
167- 'key2' : {
168- 'type' : 'number' ,
169- },
170- },
171- },
159+ inputSchema = inputSchema ,
172160 ),
173161 ]
174162 result = _mcp_utils .mcp_to_gemini_tools (mcp_tools )
@@ -178,13 +166,7 @@ def test_properties_conversion():
178166 types .FunctionDeclaration (
179167 name = 'tool' ,
180168 description = 'tool-description' ,
181- parameters = types .Schema (
182- type = 'OBJECT' ,
183- properties = {
184- 'key1' : types .Schema (type = 'STRING' ),
185- 'key2' : types .Schema (type = 'NUMBER' ),
186- },
187- ),
169+ parameters_json_schema = inputSchema ,
188170 ),
189171 ],
190172 ),
0 commit comments