|
20 | 20 | import json |
21 | 21 | from sqlalchemy import create_engine |
22 | 22 | from sqlalchemy.orm import Session |
23 | | -from pathlib import Path |
| 23 | + |
24 | 24 | import zipfile |
25 | 25 | import httpx |
26 | 26 | import aiofiles |
@@ -88,7 +88,7 @@ def store_new_source(self, repo, source_location, type, notes, update = False): |
88 | 88 | with Session(self.engine) as session: |
89 | 89 | existing = session.query(Source).filter_by(repo = repo, source_location = source_location).first() |
90 | 90 | if existing: |
91 | | - existing.notes += notes |
| 91 | + existing.notes = (existing.notes or "") + notes |
92 | 92 | session.commit() |
93 | 93 | return f"Updated notes for source at {source_location} in {repo}." |
94 | 94 | else: |
@@ -120,7 +120,7 @@ def _csv_parse(raw): |
120 | 120 | for j, k in enumerate(keys): |
121 | 121 | this_obj[k.strip()] = row[j + 2] |
122 | 122 | results.append(this_obj) |
123 | | - except csv.Error as e: |
| 123 | + except (csv.Error, IndexError, ValueError) as e: |
124 | 124 | return ["Error: CSV parsing error: " + str(e)] |
125 | 125 | return results |
126 | 126 |
|
@@ -218,7 +218,7 @@ def clear_codeql_repo(owner: str, repo: str): |
218 | 218 |
|
219 | 219 | @mcp.tool() |
220 | 220 | def get_file_contents( |
221 | | - file_uri: str = Field(description="The file URI to get contents for. The URI scheme is defined as `file://path` and `file://path:region`. Examples of file URI: `file:///path/to/file:1:2:3:4`, `file:///path/to/file`. File URIs optionally contain a region definition that looks like `start_line:start_column:end_line:end_column` which will limit the contents returned to the specified region, for example `file:///path/to/file:1:2:3:4` indicates a file region of `1:2:3:4` which would return the content of the file starting at line 1, column 1 and ending at line 3 column 4. Line and column indices are 1-based, meaning line and column values start at 1. If the region is ommitted the full contents of the file will be returned, for example `file:///path/to/file` returns the full contents of `/path/to/file`."), |
| 221 | + file_uri: str = Field(description="The file URI to get contents for. The URI scheme is defined as `file://path` and `file://path:region`. Examples of file URI: `file:///path/to/file:1:2:3:4`, `file:///path/to/file`. File URIs optionally contain a region definition that looks like `start_line:start_column:end_line:end_column` which will limit the contents returned to the specified region, for example `file:///path/to/file:1:2:3:4` indicates a file region of `1:2:3:4` which would return the content of the file starting at line 1, column 1 and ending at line 3 column 4. Line and column indices are 1-based, meaning line and column values start at 1. If the region is omitted the full contents of the file will be returned, for example `file:///path/to/file` returns the full contents of `/path/to/file`."), |
222 | 222 | database_path: str = Field(description="The path to the CodeQL database.")): |
223 | 223 | """Get the contents of a file URI from a CodeQL database path.""" |
224 | 224 |
|
|
0 commit comments