Skip to content

Commit edab435

Browse files
author
Zhe Yu
committed
fix(cli): safeguard the output processing.
1 parent c84ff39 commit edab435

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/vectorcode/mcp_main.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,14 @@ async def query_tool(
215215
configs=query_config,
216216
)
217217
results: list[str] = []
218-
for path in result_paths:
219-
if os.path.isfile(path):
220-
with open(path) as fin:
221-
rel_path = os.path.relpath(path, config.project_root)
222-
results.append(
223-
f"<path>{rel_path}</path>\n<content>{fin.read()}</content>",
224-
)
218+
for result in result_paths:
219+
if isinstance(result, str):
220+
if os.path.isfile(result):
221+
with open(result) as fin:
222+
rel_path = os.path.relpath(result, config.project_root)
223+
results.append(
224+
f"<path>{rel_path}</path>\n<content>{fin.read()}</content>",
225+
)
225226
logger.info("Retrieved the following files: %s", result_paths)
226227
return results
227228

0 commit comments

Comments
 (0)