Skip to content

Commit e8f53d0

Browse files
author
Maxim Titovich
committed
feat: Enhance file content retrieval with advanced chunking and optional plain text mode
- Add new methods `getCompletePullRequestFileContent` and `getCompleteFileFromBranch` for seamless file retrieval - Implement parallel chunk retrieval with 5-minute timeout for large files - Add optional `returnPlainText` parameter to control file content retrieval mode - Improve error handling and logging for file content tools - Update README with detailed usage examples and parameter descriptions - Bump version to 1.0.5
1 parent a3ea27a commit e8f53d0

6 files changed

+890
-371
lines changed

README.md

+34-5
Original file line numberDiff line numberDiff line change
@@ -216,25 +216,54 @@ registerTools(server, azureDevOpsService);
216216
| `azure_devops_pull_request_threads` | Get threads from a pull request | `repositoryId` (string), `pullRequestId` (number), `project` (string) |
217217
| `azure_devops_work_item_attachments`| Get attachments for a work item | `id` (number) |
218218
| `azure_devops_pull_request_changes` | Get detailed PR code changes | `repositoryId` (string), `pullRequestId` (number), `project` (string) |
219-
| `azure_devops_pull_request_file_content` | Get content of large files in chunks | `repositoryId` (string), `pullRequestId` (number), `filePath` (string), `objectId` (string), `startPosition` (number), `length` (number), `project` (string) |
220-
| `azure_devops_branch_file_content` | Get file content directly from a branch | `repositoryId` (string), `branchName` (string), `filePath` (string), `startPosition` (number), `length` (number), `project` (string) |
219+
| `azure_devops_pull_request_file_content` | Get content of a specific file in a pull request | `repositoryId` (string), `pullRequestId` (number), `filePath` (string), `objectId` (string), `project` (string), optional: `returnPlainText` (boolean), `startPosition` (number), `length` (number) |
220+
| `azure_devops_branch_file_content` | Get file content directly from a branch | `repositoryId` (string), `branchName` (string), `filePath` (string), `project` (string), optional: `returnPlainText` (boolean), `startPosition` (number), `length` (number) |
221221
| `azure_devops_create_pr_comment` | Create a comment on a pull request | `repositoryId` (string), `pullRequestId` (number), `project` (string), `content` (string), and other optional parameters |
222222

223223
### File Content Tools
224224

225225
The file content tools (`azure_devops_pull_request_file_content` and `azure_devops_branch_file_content`) provide robust ways to access file content from repositories and pull requests:
226226

227+
- **Complete file retrieval**: By default, returns the complete file as plain text (set `returnPlainText=true` or omit this parameter)
228+
- **Chunked access**: When `returnPlainText=false`, allows accessing large files in chunks by specifying start position and length
229+
- **Parallel chunk retrieval**: Large files are retrieved using multiple parallel requests for better performance
230+
- **5-minute timeout**: Extended timeout to ensure even large files can be retrieved completely
227231
- **Automatic fallback**: If direct object ID access fails, the system will try accessing by branch name
228232
- **Binary file detection**: Binary files are detected and handled appropriately
229233
- **Circular reference handling**: Prevents JSON serialization errors due to circular references
230-
- **Chunked access**: Large files can be accessed in chunks by specifying start position and length
231234
- **Error reporting**: Detailed error messages are provided when file access fails
232235

236+
#### Example Usage:
237+
238+
**Get complete file as plain text (default):**
239+
```json
240+
{
241+
"repositoryId": "your-repo-id",
242+
"pullRequestId": 123,
243+
"filePath": "src/path/to/file.ts",
244+
"objectId": "file-object-id",
245+
"project": "YourProject"
246+
}
247+
```
248+
249+
**Get file in chunks with metadata:**
250+
```json
251+
{
252+
"repositoryId": "your-repo-id",
253+
"branchName": "main",
254+
"filePath": "src/path/to/file.ts",
255+
"project": "YourProject",
256+
"returnPlainText": false,
257+
"startPosition": 0,
258+
"length": 100000
259+
}
260+
```
261+
233262
When accessing large files or files in complex repositories, you may need to:
234263

235-
1. First try `azure_devops_pull_request_file_content` with the object ID from the PR changes
264+
1. First try `azure_devops_pull_request_file_content` with the object ID from the PR changes and default `returnPlainText=true` to get the complete file
236265
2. If that fails, use `azure_devops_branch_file_content` with the branch name from the PR details
237-
3. For very large files, break down your requests into smaller chunks
266+
3. For very large binary files, you may need to set `returnPlainText=false` and break down your requests into smaller chunks
238267

239268
## Development
240269

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cursor-azure-devops-mcp",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "MCP Server for Cursor IDE-Azure DevOps Integration",
55
"main": "build/index.js",
66
"type": "module",

0 commit comments

Comments
 (0)