Skip to content

Commit cd74dd6

Browse files
Merge pull request #7 from GitHubSecurityLab/param-fields
Add Field descriptions
2 parents 8f81d69 + 2c40bc5 commit cd74dd6

File tree

1 file changed

+89
-45
lines changed

1 file changed

+89
-45
lines changed

src/seclab_taskflows/mcp_servers/repo_context.py

Lines changed: 89 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -338,18 +338,22 @@ def clear_repo_issues(self, repo):
338338
backend = RepoContextBackend(MEMORY)
339339

340340
@mcp.tool()
341-
def store_new_component(owner: str, repo: str, location: str = Field(description="The directory of the component"),
342-
is_app: bool = Field(description="Is this an application", default=None),
343-
is_library: bool = Field(description="Is this a library", default=None),
344-
notes: str = Field(description="The notes taken for this component", default="")):
341+
def store_new_component(owner: str = Field(description="The owner of the GitHub repository"),
342+
repo: str = Field(description="The name of the GitHub repository"),
343+
location: str = Field(description="The directory of the component"),
344+
is_app: bool = Field(description="Is this an application", default=None),
345+
is_library: bool = Field(description="Is this a library", default=None),
346+
notes: str = Field(description="The notes taken for this component", default="")):
345347
"""
346348
Stores a new component in the database.
347349
"""
348350
return backend.store_new_application(process_repo(owner, repo), location, is_app, is_library, notes)
349351

350352
@mcp.tool()
351-
def add_component_notes(owner: str, repo: str, location: str = Field(description="The directory of the component", default=None),
352-
notes: str = Field(description="New notes taken for this component", default="")):
353+
def add_component_notes(owner: str = Field(description="The owner of the GitHub repository"),
354+
repo: str = Field(description="The name of the GitHub repository"),
355+
location: str = Field(description="The directory of the component", default=None),
356+
notes: str = Field(description="New notes taken for this component", default="")):
353357
"""
354358
Add new notes to a component
355359
"""
@@ -360,7 +364,9 @@ def add_component_notes(owner: str, repo: str, location: str = Field(description
360364
return backend.store_new_application(repo, location, None, None, notes)
361365

362366
@mcp.tool()
363-
def store_new_entry_point(owner: str, repo: str, location: str = Field(description="The directory of the component where the entry point belonged to"),
367+
def store_new_entry_point(owner: str = Field(description="The owner of the GitHub repository"),
368+
repo: str = Field(description="The name of the GitHub repository"),
369+
location: str = Field(description="The directory of the component where the entry point belongs to"),
364370
file: str = Field(description="The file that contains the entry point"),
365371
line: int = Field(description="The file line that contains the entry point"),
366372
user_input: str = Field(description="The variables that are considered as user input"),
@@ -375,45 +381,54 @@ def store_new_entry_point(owner: str, repo: str, location: str = Field(descripti
375381
return backend.store_new_entry_point(repo, app.id, file, user_input, line, notes)
376382

377383
@mcp.tool()
378-
def store_new_component_issue(owner: str, repo: str, component_id: int,
379-
issue_type: str, notes: str):
384+
def store_new_component_issue(owner: str = Field(description="The owner of the GitHub repository"),
385+
repo: str = Field(description="The name of the GitHub repository"),
386+
component_id: int = Field(description="The ID of the component"),
387+
issue_type: str = Field(description="The type of issue"),
388+
notes: str = Field(description="Notes about the issue")):
380389
"""
381390
Stores a type of common issue for a component.
382391
"""
383392
repo = process_repo(owner, repo)
384393
return backend.store_new_component_issue(repo, component_id, issue_type, notes)
385394

386395
@mcp.tool()
387-
def store_new_audit_result(owner: str, repo: str, component_id: int, issue_type: str, issue_id: int,
388-
has_non_security_error: bool = Field(description="Set to true if there are security issues or logic error but may not be exploitable"),
389-
has_vulnerability: bool = Field(description="Set to true if a security vulnerability is identified"),
390-
notes: str = Field(description="The notes for the audit of this issue")):
396+
def store_new_audit_result(owner: str = Field(description="The owner of the GitHub repository"),
397+
repo: str = Field(description="The name of the GitHub repository"),
398+
component_id: int = Field(description="The ID of the component"),
399+
issue_type: str = Field(description="The type of issue"),
400+
issue_id: int = Field(description="The ID of the issue"),
401+
has_non_security_error: bool = Field(description="Set to true if there are security issues or logic error but may not be exploitable"),
402+
has_vulnerability: bool = Field(description="Set to true if a security vulnerability is identified"),
403+
notes: str = Field(description="The notes for the audit of this issue")):
391404
"""
392405
Stores the audit result for issue with issue_id.
393406
"""
394407
repo = process_repo(owner, repo)
395408
return backend.store_new_audit_result(repo, component_id, issue_type, issue_id, has_non_security_error, has_vulnerability, notes)
396409

397410
@mcp.tool()
398-
def store_new_web_entry_point(owner: str, repo: str,
399-
entry_point_id: int = Field(description="The ID of the entry point this web entry point refers to"),
400-
location: str = Field(description="The directory of the component where the web entry point belongs to"),
401-
method: str = Field(description="HTTP method (GET, POST, etc)", default=""),
402-
path: str = Field(description="URL path (e.g., /info)", default=""),
403-
component: int = Field(description="Component identifier", default=0),
404-
auth: str = Field(description="Authentication information", default=""),
405-
middleware: str = Field(description="Middleware information", default=""),
406-
roles_scopes: str = Field(description="Roles and scopes information", default=""),
407-
notes: str = Field(description="Notes for this web entry point", default="")):
411+
def store_new_web_entry_point(owner: str = Field(description="The owner of the GitHub repository"),
412+
repo: str = Field(description="The name of the GitHub repository"),
413+
entry_point_id: int = Field(description="The ID of the entry point this web entry point refers to"),
414+
location: str = Field(description="The directory of the component where the web entry point belongs to"),
415+
method: str = Field(description="HTTP method (GET, POST, etc)", default=""),
416+
path: str = Field(description="URL path (e.g., /info)", default=""),
417+
component: int = Field(description="Component identifier", default=0),
418+
auth: str = Field(description="Authentication information", default=""),
419+
middleware: str = Field(description="Middleware information", default=""),
420+
roles_scopes: str = Field(description="Roles and scopes information", default=""),
421+
notes: str = Field(description="Notes for this web entry point", default="")):
408422
"""
409423
Stores a new web entry point in a component to the database. A web entry point extends a regular entry point
410424
with web-specific properties like HTTP method, path, authentication, middleware, and roles/scopes.
411425
"""
412426
return backend.store_new_web_entry_point(process_repo(owner, repo), entry_point_id, method, path, component, auth, middleware, roles_scopes, notes)
413427

414428
@mcp.tool()
415-
def add_entry_point_notes(owner: str, repo: str,
416-
location: str = Field(description="The directory of the component where the entry point belonged to"),
429+
def add_entry_point_notes(owner: str = Field(description="The owner of the GitHub repository"),
430+
repo: str = Field(description="The name of the GitHub repository"),
431+
location: str = Field(description="The directory of the component where the entry point belongs to"),
417432
file: str = Field(description="The file that contains the entry point"),
418433
line: int = Field(description="The file line that contains the entry point"),
419434
notes: str = Field(description="The notes for this entry point", default = "")):
@@ -428,7 +443,9 @@ def add_entry_point_notes(owner: str, repo: str,
428443

429444

430445
@mcp.tool()
431-
def store_new_user_action(owner: str, repo: str, location: str = Field(description="The directory of the component where the user action belonged to"),
446+
def store_new_user_action(owner: str = Field(description="The owner of the GitHub repository"),
447+
repo: str = Field(description="The name of the GitHub repository"),
448+
location: str = Field(description="The directory of the component where the user action belongs to"),
432449
file: str = Field(description="The file that contains the user action"),
433450
line: int = Field(description="The file line that contains the user action"),
434451
notes: str = Field(description="New notes for this user action", default = "")):
@@ -442,7 +459,9 @@ def store_new_user_action(owner: str, repo: str, location: str = Field(descripti
442459
return backend.store_new_user_action(repo, app.id, file, line, notes)
443460

444461
@mcp.tool()
445-
def add_user_action_notes(owner: str, repo: str, location: str = Field(description="The directory of the component where the user action belonged to"),
462+
def add_user_action_notes(owner: str = Field(description="The owner of the GitHub repository"),
463+
repo: str = Field(description="The name of the GitHub repository"),
464+
location: str = Field(description="The directory of the component where the user action belongs to"),
446465
file: str = Field(description="The file that contains the user action"),
447466
line: str = Field(description="The file line that contains the user action"),
448467
notes: str = Field(description="The notes for user action", default = "")):
@@ -453,9 +472,11 @@ def add_user_action_notes(owner: str, repo: str, location: str = Field(descripti
453472
return backend.store_new_user_action(repo, app.id, file, line, notes, True)
454473

455474
@mcp.tool()
456-
def get_component(owner: str, repo: str, location: str = Field(description="The directory of the component")):
475+
def get_component(owner: str = Field(description="The owner of the GitHub repository"),
476+
repo: str = Field(description="The name of the GitHub repository"),
477+
location: str = Field(description="The directory of the component")):
457478
"""
458-
The a component from the database
479+
Get a component from the database
459480
"""
460481
repo = process_repo(owner, repo)
461482
app = backend.get_app(repo, location)
@@ -464,127 +485,150 @@ def get_component(owner: str, repo: str, location: str = Field(description="The
464485
return json.dumps(app_to_dict(app))
465486

466487
@mcp.tool()
467-
def get_components(owner: str, repo: str):
488+
def get_components(owner: str = Field(description="The owner of the GitHub repository"),
489+
repo: str = Field(description="The name of the GitHub repository")):
468490
"""
469491
Get components from the repo
470492
"""
471493
repo = process_repo(owner, repo)
472494
return json.dumps(backend.get_apps(repo))
473495

474496
@mcp.tool()
475-
def get_entry_points(owner: str, repo: str, location: str = Field(description="The directory of the component")):
497+
def get_entry_points(owner: str = Field(description="The owner of the GitHub repository"),
498+
repo: str = Field(description="The name of the GitHub repository"),
499+
location: str = Field(description="The directory of the component")):
476500
"""
477501
Get all the entry points of a component.
478502
"""
479503
repo = process_repo(owner, repo)
480504
return json.dumps(backend.get_app_entries(repo, location))
481505

482506
@mcp.tool()
483-
def get_entry_points_for_repo(owner: str, repo: str):
507+
def get_entry_points_for_repo(owner: str = Field(description="The owner of the GitHub repository"),
508+
repo: str = Field(description="The name of the GitHub repository")):
484509
"""
485510
Get all entry points of an repo
486511
"""
487512
repo = process_repo(owner, repo)
488513
return json.dumps(backend.get_app_entries_for_repo(repo))
489514

490515
@mcp.tool()
491-
def get_web_entry_points_component(owner: str, repo: str, component_id: int):
516+
def get_web_entry_points_component(owner: str = Field(description="The owner of the GitHub repository"),
517+
repo: str = Field(description="The name of the GitHub repository"),
518+
component_id: int = Field(description="The ID of the component")):
492519
"""
493520
Get all web entry points for a component
494521
"""
495522
repo = process_repo(owner, repo)
496523
return json.dumps(backend.get_web_entries(repo, component_id))
497524

498525
@mcp.tool()
499-
def get_web_entry_points_for_repo(owner: str, repo: str):
526+
def get_web_entry_points_for_repo(owner: str = Field(description="The owner of the GitHub repository"),
527+
repo: str = Field(description="The name of the GitHub repository")):
500528
"""
501529
Get all web entry points of an repo
502530
"""
503531
repo = process_repo(owner, repo)
504532
return json.dumps(backend.get_web_entries_for_repo(repo))
505533

506534
@mcp.tool()
507-
def get_user_actions(owner: str, repo: str, location: str = Field(description="The directory of the component")):
535+
def get_user_actions(owner: str = Field(description="The owner of the GitHub repository"),
536+
repo: str = Field(description="The name of the GitHub repository"),
537+
location: str = Field(description="The directory of the component")):
508538
"""
509539
Get all the user actions in a component.
510540
"""
511541
repo = process_repo(owner, repo)
512542
return json.dumps(backend.get_user_actions(repo, location))
513543

514544
@mcp.tool()
515-
def get_user_actions_for_repo(owner: str, repo: str):
545+
def get_user_actions_for_repo(owner: str = Field(description="The owner of the GitHub repository"),
546+
repo: str = Field(description="The name of the GitHub repository")):
516547
"""
517548
Get all the user actions in a repo.
518549
"""
519550
repo = process_repo(owner, repo)
520551
return json.dumps(backend.get_user_actions_for_repo(repo))
521552

522553
@mcp.tool()
523-
def get_component_issues(owner: str, repo: str, component_id: int):
554+
def get_component_issues(owner: str = Field(description="The owner of the GitHub repository"),
555+
repo: str = Field(description="The name of the GitHub repository"),
556+
component_id: int = Field(description="The ID of the component")):
524557
"""
525558
Get issues for the component.
526559
"""
527560
repo = process_repo(owner, repo)
528561
return json.dumps(backend.get_app_issues(repo, component_id))
529562

530563
@mcp.tool()
531-
def get_component_results(owner: str, repo: str, component_id: int):
564+
def get_component_results(owner: str = Field(description="The owner of the GitHub repository"),
565+
repo: str = Field(description="The name of the GitHub repository"),
566+
component_id: int = Field(description="The ID of the component")):
532567
"""
533568
Get audit results for the component.
534569
"""
535570
repo = process_repo(owner, repo)
536571
return json.dumps(backend.get_app_audit_results(repo, component_id, None, None))
537572

538573
@mcp.tool()
539-
def get_component_vulnerable_results(owner: str, repo: str, component_id: int):
574+
def get_component_vulnerable_results(owner: str = Field(description="The owner of the GitHub repository"),
575+
repo: str = Field(description="The name of the GitHub repository"),
576+
component_id: int = Field(description="The ID of the component")):
540577
"""
541578
Get audit results for the component that are audited as vulnerable.
542579
"""
543580
repo = process_repo(owner, repo)
544581
return json.dumps(backend.get_app_audit_results(repo, component_id, has_non_security_error = None, has_vulnerability = True))
545582

546583
@mcp.tool()
547-
def get_component_potential_results(owner: str, repo: str, component_id: int):
584+
def get_component_potential_results(owner: str = Field(description="The owner of the GitHub repository"),
585+
repo: str = Field(description="The name of the GitHub repository"),
586+
component_id: int = Field(description="The ID of the component")):
548587
"""
549588
Get audit results for the component that are audited as an issue but may not be exploitable.
550589
"""
551590
repo = process_repo(owner, repo)
552591
return json.dumps(backend.get_app_audit_results(repo, component_id, has_non_security_error = True, has_vulnerability = None))
553592

554593
@mcp.tool()
555-
def get_audit_results_for_repo(owner: str, repo: str):
594+
def get_audit_results_for_repo(owner: str = Field(description="The owner of the GitHub repository"),
595+
repo: str = Field(description="The name of the GitHub repository")):
556596
"""
557597
Get audit results for the repo.
558598
"""
559599
repo = process_repo(owner, repo)
560600
return json.dumps(backend.get_app_audit_results(repo, component_id = None, has_non_security_error = None, has_vulnerability = None))
561601

562602
@mcp.tool()
563-
def get_vulnerable_audit_results_for_repo(owner: str, repo: str):
603+
def get_vulnerable_audit_results_for_repo(owner: str = Field(description="The owner of the GitHub repository"),
604+
repo: str = Field(description="The name of the GitHub repository")):
564605
"""
565606
Get audit results for the repo that are audited as vulnerable.
566607
"""
567608
repo = process_repo(owner, repo)
568609
return json.dumps(backend.get_app_audit_results(repo, component_id = None, has_non_security_error = None, has_vulnerability = True))
569610

570611
@mcp.tool()
571-
def get_potential_audit_results_for_repo(owner: str, repo: str):
612+
def get_potential_audit_results_for_repo(owner: str = Field(description="The owner of the GitHub repository"),
613+
repo: str = Field(description="The name of the GitHub repository")):
572614
"""
573615
Get audit results for the repo that are potential issues but may not be exploitable.
574616
"""
575617
repo = process_repo(owner, repo)
576618
return json.dumps(backend.get_app_audit_results(repo, component_id = None, has_non_security_error = True, has_vulnerability = None))
577619

578620
@mcp.tool()
579-
def clear_repo(owner: str, repo: str):
621+
def clear_repo(owner: str = Field(description="The owner of the GitHub repository"),
622+
repo: str = Field(description="The name of the GitHub repository")):
580623
"""
581624
clear all results for repo.
582625
"""
583626
repo = process_repo(owner, repo)
584627
return backend.clear_repo(repo)
585628

586629
@mcp.tool()
587-
def clear_component_issues_for_repo(owner: str, repo: str):
630+
def clear_component_issues_for_repo(owner: str = Field(description="The owner of the GitHub repository"),
631+
repo: str = Field(description="The name of the GitHub repository")):
588632
"""
589633
clear all results for repo.
590634
"""

0 commit comments

Comments
 (0)