From b7f6957402b03c8fbf56d1c1a65e47396912b922 Mon Sep 17 00:00:00 2001 From: Sylwia Budzynska <102833689+sylwia-budzynska@users.noreply.github.com> Date: Wed, 3 Dec 2025 16:29:43 +0000 Subject: [PATCH] Add Field descriptions --- .../mcp_servers/repo_context.py | 96 +++++++++++++------ 1 file changed, 69 insertions(+), 27 deletions(-) diff --git a/src/seclab_taskflows/mcp_servers/repo_context.py b/src/seclab_taskflows/mcp_servers/repo_context.py index d4c5917..07b2573 100644 --- a/src/seclab_taskflows/mcp_servers/repo_context.py +++ b/src/seclab_taskflows/mcp_servers/repo_context.py @@ -340,7 +340,9 @@ def process_repo(owner, repo): return f"{owner}/{repo}".lower() @mcp.tool() -def store_new_component(owner: str, repo: str, location: str = Field(description="The directory of the component"), +def store_new_component(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + location: str = Field(description="The directory of the component"), is_app: bool = Field(description="Is this an application", default=None), is_library: bool = Field(description="Is this a library", default=None), notes: str = Field(description="The notes taken for this component", default="")): @@ -350,7 +352,9 @@ def store_new_component(owner: str, repo: str, location: str = Field(description return backend.store_new_application(process_repo(owner, repo), location, is_app, is_library, notes) @mcp.tool() -def add_component_notes(owner: str, repo: str, location: str = Field(description="The directory of the component", default=None), +def add_component_notes(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + location: str = Field(description="The directory of the component", default=None), notes: str = Field(description="New notes taken for this component", default="")): """ Add new notes to a component @@ -362,7 +366,9 @@ def add_component_notes(owner: str, repo: str, location: str = Field(description return backend.store_new_application(repo, location, None, None, notes) @mcp.tool() -def store_new_entry_point(owner: str, repo: str, location: str = Field(description="The directory of the component where the entry point belonged to"), +def store_new_entry_point(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + location: str = Field(description="The directory of the component where the entry point belonged to"), file: str = Field(description="The file that contains the entry point"), line: int = Field(description="The file line that contains the entry point"), user_input: str = Field(description="The variables that are considered as user input"), @@ -377,8 +383,11 @@ def store_new_entry_point(owner: str, repo: str, location: str = Field(descripti return backend.store_new_entry_point(repo, app.id, file, user_input, line, notes) @mcp.tool() -def store_new_component_issue(owner: str, repo: str, component_id: int, - issue_type: str, notes: str): +def store_new_component_issue(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + component_id: int = Field(description="The id of a given component"), + issue_type: str = Field(description="The type of issue identified for the component"), + notes: str = Field(description="Notes describing the issue")): """ Stores a type of common issue for a component. """ @@ -386,7 +395,11 @@ def store_new_component_issue(owner: str, repo: str, component_id: int, return backend.store_new_component_issue(repo, component_id, issue_type, notes) @mcp.tool() -def store_new_audit_result(owner: str, repo: str, component_id: int, issue_type: str, issue_id: int, +def store_new_audit_result(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + component_id: int = Field(description="The id of a given component"), + issue_type: str = Field(description="The type of issue being audited"), + issue_id: int = Field(description="The unique identifier for the issue"), has_non_security_error: bool = Field(description="Set to true if there are security issues or logic error but may not be exploitable"), has_vulnerability: bool = Field(description="Set to true if a security vulnerability is identified"), notes: str = Field(description="The notes for the audit of this issue")): @@ -397,7 +410,8 @@ def store_new_audit_result(owner: str, repo: str, component_id: int, issue_type: return backend.store_new_audit_result(repo, component_id, issue_type, issue_id, has_non_security_error, has_vulnerability, notes) @mcp.tool() -def store_new_web_entry_point(owner: str, repo: str, +def store_new_web_entry_point(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), entry_point_id: int = Field(description="The ID of the entry point this web entry point refers to"), location: str = Field(description="The directory of the component where the web entry point belongs to"), method: str = Field(description="HTTP method (GET, POST, etc)", default=""), @@ -414,7 +428,8 @@ def store_new_web_entry_point(owner: str, repo: str, return backend.store_new_web_entry_point(process_repo(owner, repo), entry_point_id, method, path, component, auth, middleware, roles_scopes, notes) @mcp.tool() -def add_entry_point_notes(owner: str, repo: str, +def add_entry_point_notes(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), location: str = Field(description="The directory of the component where the entry point belonged to"), file: str = Field(description="The file that contains the entry point"), line: int = Field(description="The file line that contains the entry point"), @@ -430,7 +445,9 @@ def add_entry_point_notes(owner: str, repo: str, @mcp.tool() -def store_new_user_action(owner: str, repo: str, location: str = Field(description="The directory of the component where the user action belonged to"), +def store_new_user_action(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + location: str = Field(description="The directory of the component where the user action belonged to"), file: str = Field(description="The file that contains the user action"), line: int = Field(description="The file line that contains the user action"), notes: str = Field(description="New notes for this user action", default = "")): @@ -444,7 +461,9 @@ def store_new_user_action(owner: str, repo: str, location: str = Field(descripti return backend.store_new_user_action(repo, app.id, file, line, notes) @mcp.tool() -def add_user_action_notes(owner: str, repo: str, location: str = Field(description="The directory of the component where the user action belonged to"), +def add_user_action_notes(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + location: str = Field(description="The directory of the component where the user action belonged to"), file: str = Field(description="The file that contains the user action"), line: str = Field(description="The file line that contains the user action"), notes: str = Field(description="The notes for user action", default = "")): @@ -455,7 +474,9 @@ def add_user_action_notes(owner: str, repo: str, location: str = Field(descripti return backend.store_new_user_action(repo, app.id, file, line, notes, True) @mcp.tool() -def get_component(owner: str, repo: str, location: str = Field(description="The directory of the component")): +def get_component(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + location: str = Field(description="The directory of the component")): """ The a component from the database """ @@ -466,7 +487,7 @@ def get_component(owner: str, repo: str, location: str = Field(description="The return json.dumps(app_to_dict(app)) @mcp.tool() -def get_components(owner: str, repo: str): +def get_components(owner: str = Field(description="The owner of the GitHub repository"), repo: str = Field(description="The name of the GitHub repository")): """ Get components from the repo """ @@ -474,7 +495,8 @@ def get_components(owner: str, repo: str): return json.dumps(backend.get_apps(repo)) @mcp.tool() -def get_entry_points(owner: str, repo: str, location: str = Field(description="The directory of the component")): +def get_entry_points(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), location: str = Field(description="The directory of the component")): """ Get all the entry points of a component. """ @@ -482,7 +504,8 @@ def get_entry_points(owner: str, repo: str, location: str = Field(description="T return json.dumps(backend.get_app_entries(repo, location)) @mcp.tool() -def get_entry_points_for_repo(owner: str, repo: str): +def get_entry_points_for_repo(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository")): """ Get all entry points of an repo """ @@ -490,7 +513,9 @@ def get_entry_points_for_repo(owner: str, repo: str): return json.dumps(backend.get_app_entries_for_repo(repo)) @mcp.tool() -def get_web_entry_points_component(owner: str, repo: str, component_id: int): +def get_web_entry_points_component(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + component_id: int = Field(description="The id of a given component")): """ Get all web entry points for a component """ @@ -498,7 +523,8 @@ def get_web_entry_points_component(owner: str, repo: str, component_id: int): return json.dumps(backend.get_web_entries(repo, component_id)) @mcp.tool() -def get_web_entry_points_for_repo(owner: str, repo: str): +def get_web_entry_points_for_repo(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository")): """ Get all web entry points of an repo """ @@ -506,7 +532,9 @@ def get_web_entry_points_for_repo(owner: str, repo: str): return json.dumps(backend.get_web_entries_for_repo(repo)) @mcp.tool() -def get_user_actions(owner: str, repo: str, location: str = Field(description="The directory of the component")): +def get_user_actions(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + location: str = Field(description="The directory of the component")): """ Get all the user actions in a component. """ @@ -514,7 +542,8 @@ def get_user_actions(owner: str, repo: str, location: str = Field(description="T return json.dumps(backend.get_user_actions(repo, location)) @mcp.tool() -def get_user_actions_for_repo(owner: str, repo: str): +def get_user_actions_for_repo(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository")): """ Get all the user actions in a repo. """ @@ -522,7 +551,9 @@ def get_user_actions_for_repo(owner: str, repo: str): return json.dumps(backend.get_user_actions_for_repo(repo)) @mcp.tool() -def get_component_issues(owner: str, repo: str, component_id: int): +def get_component_issues(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + component_id: int = Field(description="The id of a given component")): """ Get issues for the component. """ @@ -530,7 +561,9 @@ def get_component_issues(owner: str, repo: str, component_id: int): return json.dumps(backend.get_app_issues(repo, component_id)) @mcp.tool() -def get_component_results(owner: str, repo: str, component_id: int): +def get_component_results(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + component_id: int = Field(description="The id of a given component")): """ Get audit results for the component. """ @@ -538,7 +571,9 @@ def get_component_results(owner: str, repo: str, component_id: int): return json.dumps(backend.get_app_audit_results(repo, component_id, None, None)) @mcp.tool() -def get_component_vulnerable_results(owner: str, repo: str, component_id: int): +def get_component_vulnerable_results(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + component_id: int = Field(description="The id of a given component")): """ Get audit results for the component that are audited as vulnerable. """ @@ -546,7 +581,9 @@ def get_component_vulnerable_results(owner: str, repo: str, component_id: int): return json.dumps(backend.get_app_audit_results(repo, component_id, has_non_security_error = None, has_vulnerability = True)) @mcp.tool() -def get_component_potential_results(owner: str, repo: str, component_id: int): +def get_component_potential_results(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository"), + component_id: int = Field(description="The id of a given component")): """ Get audit results for the component that are audited as an issue but may not be exploitable. """ @@ -554,7 +591,8 @@ def get_component_potential_results(owner: str, repo: str, component_id: int): return json.dumps(backend.get_app_audit_results(repo, component_id, has_non_security_error = True, has_vulnerability = None)) @mcp.tool() -def get_audit_results_for_repo(owner: str, repo: str): +def get_audit_results_for_repo(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository")): """ Get audit results for the repo. """ @@ -562,7 +600,8 @@ def get_audit_results_for_repo(owner: str, repo: str): return json.dumps(backend.get_app_audit_results(repo, component_id = None, has_non_security_error = None, has_vulnerability = None)) @mcp.tool() -def get_vulnerable_audit_results_for_repo(owner: str, repo: str): +def get_vulnerable_audit_results_for_repo(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository")): """ Get audit results for the repo that are audited as vulnerable. """ @@ -570,7 +609,8 @@ def get_vulnerable_audit_results_for_repo(owner: str, repo: str): return json.dumps(backend.get_app_audit_results(repo, component_id = None, has_non_security_error = None, has_vulnerability = True)) @mcp.tool() -def get_potential_audit_results_for_repo(owner: str, repo: str): +def get_potential_audit_results_for_repo(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository")): """ Get audit results for the repo that are potential issues but may not be exploitable. """ @@ -578,7 +618,8 @@ def get_potential_audit_results_for_repo(owner: str, repo: str): return json.dumps(backend.get_app_audit_results(repo, component_id = None, has_non_security_error = True, has_vulnerability = None)) @mcp.tool() -def clear_repo(owner: str, repo: str): +def clear_repo(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository")): """ clear all results for repo. """ @@ -586,7 +627,8 @@ def clear_repo(owner: str, repo: str): return backend.clear_repo(repo) @mcp.tool() -def clear_component_issues_for_repo(owner: str, repo: str): +def clear_component_issues_for_repo(owner: str = Field(description="The owner of the GitHub repository"), + repo: str = Field(description="The name of the GitHub repository")): """ clear all results for repo. """