lailaelkoussy commited on
Commit
2a3b71b
Β·
1 Parent(s): ce21092

update README + cleanup search_nodes tool

Browse files
Files changed (1) hide show
  1. gradio_mcp_space.py +0 -34
gradio_mcp_space.py CHANGED
@@ -242,40 +242,6 @@ def search_nodes(query: str, limit: int = 10) -> str:
242
  content = res.get('content', '')
243
  if content:
244
  result += f" Content: {content}\n"
245
-
246
- # Handle declared entities - parse JSON if it's a string
247
- declared = res.get('declared_entities', '')
248
- if declared and declared != '[]':
249
- try:
250
- # Try to parse as JSON if it's a string
251
- import json
252
- if isinstance(declared, str):
253
- declared = json.loads(declared)
254
- # Extract entity names from the list of dicts
255
- if isinstance(declared, list) and declared:
256
- entity_names = [e.get('name', str(e)) if isinstance(e, dict) else str(e) for e in declared[:10]]
257
- result += f" Declared: {', '.join(entity_names)}\n"
258
- if len(declared) > 10:
259
- result += f" ... and {len(declared) - 10} more\n"
260
- except (json.JSONDecodeError, AttributeError):
261
- result += f" Declared: {declared}\n"
262
-
263
- # Handle called entities - parse JSON if it's a string
264
- called = res.get('called_entities', '')
265
- if called and called != '[]':
266
- try:
267
- # Try to parse as JSON if it's a string
268
- import json
269
- if isinstance(called, str):
270
- called = json.loads(called)
271
- # Extract entity names from the list of dicts
272
- if isinstance(called, list) and called:
273
- entity_names = [e.get('name', str(e)) if isinstance(e, dict) else str(e) for e in called[:10]]
274
- result += f" Called: {', '.join(entity_names)}\n"
275
- if len(called) > 10:
276
- result += f" ... and {len(called) - 10} more\n"
277
- except (json.JSONDecodeError, AttributeError):
278
- result += f" Called: {called}\n"
279
  result += "\n"
280
 
281
  return result
 
242
  content = res.get('content', '')
243
  if content:
244
  result += f" Content: {content}\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  result += "\n"
246
 
247
  return result