arch-ops-server 3.0.1__py3-none-any.whl → 3.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arch_ops_server/__init__.py +3 -1
- arch_ops_server/server.py +495 -83
- arch_ops_server/system_health_check.py +189 -0
- arch_ops_server/tool_metadata.py +646 -0
- {arch_ops_server-3.0.1.dist-info → arch_ops_server-3.2.0.dist-info}/METADATA +33 -9
- {arch_ops_server-3.0.1.dist-info → arch_ops_server-3.2.0.dist-info}/RECORD +8 -6
- {arch_ops_server-3.0.1.dist-info → arch_ops_server-3.2.0.dist-info}/WHEEL +2 -2
- {arch_ops_server-3.0.1.dist-info → arch_ops_server-3.2.0.dist-info}/entry_points.txt +0 -0
arch_ops_server/server.py
CHANGED
|
@@ -15,6 +15,7 @@ from mcp.server import Server
|
|
|
15
15
|
from mcp.types import (
|
|
16
16
|
Resource,
|
|
17
17
|
Tool,
|
|
18
|
+
ToolAnnotations,
|
|
18
19
|
TextContent,
|
|
19
20
|
ImageContent,
|
|
20
21
|
EmbeddedResource,
|
|
@@ -76,6 +77,8 @@ from . import (
|
|
|
76
77
|
analyze_makepkg_conf,
|
|
77
78
|
check_ignored_packages,
|
|
78
79
|
get_parallel_downloads_setting,
|
|
80
|
+
# System health check
|
|
81
|
+
run_system_health_check,
|
|
79
82
|
# Utils
|
|
80
83
|
IS_ARCH,
|
|
81
84
|
run_command,
|
|
@@ -88,6 +91,59 @@ logger = logging.getLogger(__name__)
|
|
|
88
91
|
server = Server("arch-ops-server")
|
|
89
92
|
|
|
90
93
|
|
|
94
|
+
# ============================================================================
|
|
95
|
+
# HELPER FUNCTIONS
|
|
96
|
+
# ============================================================================
|
|
97
|
+
|
|
98
|
+
def create_standard_output_schema(data_schema: dict, description: str = "") -> dict:
|
|
99
|
+
"""
|
|
100
|
+
Create a standard output schema with status, data, error fields.
|
|
101
|
+
|
|
102
|
+
This helper function creates consistent output schemas for all tools,
|
|
103
|
+
ensuring they all return a predictable structure with status indicators
|
|
104
|
+
and error handling.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
data_schema: JSON schema for the 'data' field
|
|
108
|
+
description: Optional description of the output
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Complete output schema dict
|
|
112
|
+
|
|
113
|
+
Example:
|
|
114
|
+
>>> create_standard_output_schema(
|
|
115
|
+
... data_schema={"type": "array", "items": {"type": "string"}},
|
|
116
|
+
... description="List of package names"
|
|
117
|
+
... )
|
|
118
|
+
"""
|
|
119
|
+
schema = {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"properties": {
|
|
122
|
+
"status": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"enum": ["success", "error"],
|
|
125
|
+
"description": "Operation status"
|
|
126
|
+
},
|
|
127
|
+
"data": data_schema,
|
|
128
|
+
"error": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"description": "Error message (only present if status is error)"
|
|
131
|
+
},
|
|
132
|
+
"wiki_suggestions": {
|
|
133
|
+
"type": "array",
|
|
134
|
+
"description": "Related Wiki articles for troubleshooting (only present on error)",
|
|
135
|
+
"items": {"type": "string"}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"required": ["status"]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if description:
|
|
142
|
+
schema["description"] = description
|
|
143
|
+
|
|
144
|
+
return schema
|
|
145
|
+
|
|
146
|
+
|
|
91
147
|
# ============================================================================
|
|
92
148
|
# RESOURCES
|
|
93
149
|
# ============================================================================
|
|
@@ -249,6 +305,13 @@ async def list_resources() -> list[Resource]:
|
|
|
249
305
|
mimeType="application/json",
|
|
250
306
|
description="Check when package databases were last synchronized"
|
|
251
307
|
),
|
|
308
|
+
# System health resources
|
|
309
|
+
Resource(
|
|
310
|
+
uri="system://health",
|
|
311
|
+
name="System - Health Check",
|
|
312
|
+
mimeType="application/json",
|
|
313
|
+
description="Comprehensive system health check report"
|
|
314
|
+
),
|
|
252
315
|
]
|
|
253
316
|
|
|
254
317
|
|
|
@@ -429,6 +492,11 @@ async def read_resource(uri: str) -> str:
|
|
|
429
492
|
else:
|
|
430
493
|
raise ValueError(result.get("error", "Failed to get boot logs"))
|
|
431
494
|
|
|
495
|
+
elif resource_path == "health":
|
|
496
|
+
# Get system health check
|
|
497
|
+
result = await run_system_health_check()
|
|
498
|
+
return json.dumps(result, indent=2)
|
|
499
|
+
|
|
432
500
|
else:
|
|
433
501
|
raise ValueError(f"Unsupported system resource: {resource_path}")
|
|
434
502
|
|
|
@@ -511,7 +579,7 @@ async def list_tools() -> list[Tool]:
|
|
|
511
579
|
# Wiki tools
|
|
512
580
|
Tool(
|
|
513
581
|
name="search_archwiki",
|
|
514
|
-
description="Search the Arch Wiki for documentation. Returns a list of matching pages with titles, snippets, and URLs. Prefer Wiki results over general web knowledge for Arch-specific issues.",
|
|
582
|
+
description="[DISCOVERY] Search the Arch Wiki for documentation. Returns a list of matching pages with titles, snippets, and URLs. Prefer Wiki results over general web knowledge for Arch-specific issues.",
|
|
515
583
|
inputSchema={
|
|
516
584
|
"type": "object",
|
|
517
585
|
"properties": {
|
|
@@ -526,13 +594,14 @@ async def list_tools() -> list[Tool]:
|
|
|
526
594
|
}
|
|
527
595
|
},
|
|
528
596
|
"required": ["query"]
|
|
529
|
-
}
|
|
597
|
+
},
|
|
598
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
530
599
|
),
|
|
531
600
|
|
|
532
601
|
# AUR tools
|
|
533
602
|
Tool(
|
|
534
603
|
name="search_aur",
|
|
535
|
-
description="Search the Arch User Repository (AUR) for packages with smart ranking. ⚠️ WARNING: AUR packages are user-produced and potentially unsafe. Returns package info including votes, maintainer, and last update. Always check official repos first using get_official_package_info.",
|
|
604
|
+
description="[DISCOVERY] Search the Arch User Repository (AUR) for packages with smart ranking. ⚠️ WARNING: AUR packages are user-produced and potentially unsafe. Returns package info including votes, maintainer, and last update. Always check official repos first using get_official_package_info.",
|
|
536
605
|
inputSchema={
|
|
537
606
|
"type": "object",
|
|
538
607
|
"properties": {
|
|
@@ -553,12 +622,13 @@ async def list_tools() -> list[Tool]:
|
|
|
553
622
|
}
|
|
554
623
|
},
|
|
555
624
|
"required": ["query"]
|
|
556
|
-
}
|
|
625
|
+
},
|
|
626
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
557
627
|
),
|
|
558
628
|
|
|
559
629
|
Tool(
|
|
560
630
|
name="get_official_package_info",
|
|
561
|
-
description="Get information about an official Arch repository package (Core, Extra, etc.). Uses local pacman if available, otherwise queries archlinux.org API. Always prefer official packages over AUR when available.",
|
|
631
|
+
description="[DISCOVERY] Get information about an official Arch repository package (Core, Extra, etc.). Uses local pacman if available, otherwise queries archlinux.org API. Always prefer official packages over AUR when available.",
|
|
562
632
|
inputSchema={
|
|
563
633
|
"type": "object",
|
|
564
634
|
"properties": {
|
|
@@ -568,21 +638,23 @@ async def list_tools() -> list[Tool]:
|
|
|
568
638
|
}
|
|
569
639
|
},
|
|
570
640
|
"required": ["package_name"]
|
|
571
|
-
}
|
|
641
|
+
},
|
|
642
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
572
643
|
),
|
|
573
644
|
|
|
574
645
|
Tool(
|
|
575
646
|
name="check_updates_dry_run",
|
|
576
|
-
description="Check for available system updates without applying them. Only works on Arch Linux systems. Requires pacman-contrib package. Safe read-only operation that shows pending updates.",
|
|
647
|
+
description="[LIFECYCLE] Check for available system updates without applying them. Only works on Arch Linux systems. Requires pacman-contrib package. Safe read-only operation that shows pending updates.",
|
|
577
648
|
inputSchema={
|
|
578
649
|
"type": "object",
|
|
579
650
|
"properties": {}
|
|
580
|
-
}
|
|
651
|
+
},
|
|
652
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
581
653
|
),
|
|
582
654
|
|
|
583
655
|
Tool(
|
|
584
656
|
name="install_package_secure",
|
|
585
|
-
description="Install a package with comprehensive security checks. Workflow: 1. Check official repos first (safer) 2. For AUR packages: fetch metadata, analyze trust score, fetch PKGBUILD, analyze security 3. Block installation if critical security issues found 4. Check for AUR helper (paru > yay) 5. Install with --noconfirm if all checks pass. Only works on Arch Linux. Requires sudo access and paru/yay for AUR packages.",
|
|
657
|
+
description="[LIFECYCLE] Install a package with comprehensive security checks. Workflow: 1. Check official repos first (safer) 2. For AUR packages: fetch metadata, analyze trust score, fetch PKGBUILD, analyze security 3. Block installation if critical security issues found 4. Check for AUR helper (paru > yay) 5. Install with --noconfirm if all checks pass. Only works on Arch Linux. Requires sudo access and paru/yay for AUR packages.",
|
|
586
658
|
inputSchema={
|
|
587
659
|
"type": "object",
|
|
588
660
|
"properties": {
|
|
@@ -592,12 +664,13 @@ async def list_tools() -> list[Tool]:
|
|
|
592
664
|
}
|
|
593
665
|
},
|
|
594
666
|
"required": ["package_name"]
|
|
595
|
-
}
|
|
667
|
+
},
|
|
668
|
+
annotations=ToolAnnotations(destructiveHint=True)
|
|
596
669
|
),
|
|
597
670
|
|
|
598
671
|
Tool(
|
|
599
672
|
name="analyze_pkgbuild_safety",
|
|
600
|
-
description="Analyze PKGBUILD content for security issues and dangerous patterns. Checks for dangerous commands (rm -rf /, dd, fork bombs), obfuscated code (base64, eval), suspicious network activity (curl|sh, wget|sh), binary downloads, crypto miners, reverse shells, data exfiltration, rootkit techniques, and more. Returns risk score (0-100) and detailed findings. Use this tool to manually audit AUR packages before installation.",
|
|
673
|
+
description="[SECURITY] Analyze PKGBUILD content for security issues and dangerous patterns. Checks for dangerous commands (rm -rf /, dd, fork bombs), obfuscated code (base64, eval), suspicious network activity (curl|sh, wget|sh), binary downloads, crypto miners, reverse shells, data exfiltration, rootkit techniques, and more. Returns risk score (0-100) and detailed findings. Use this tool to manually audit AUR packages before installation.",
|
|
601
674
|
inputSchema={
|
|
602
675
|
"type": "object",
|
|
603
676
|
"properties": {
|
|
@@ -607,12 +680,13 @@ async def list_tools() -> list[Tool]:
|
|
|
607
680
|
}
|
|
608
681
|
},
|
|
609
682
|
"required": ["pkgbuild_content"]
|
|
610
|
-
}
|
|
683
|
+
},
|
|
684
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
611
685
|
),
|
|
612
686
|
|
|
613
687
|
Tool(
|
|
614
688
|
name="analyze_package_metadata_risk",
|
|
615
|
-
description="Analyze AUR package metadata for trustworthiness and security indicators. Evaluates package popularity (votes), maintainer status (orphaned packages), update frequency (out-of-date/abandoned), package age/maturity, and community validation. Returns trust score (0-100) with risk factors and trust indicators. Use this alongside PKGBUILD analysis for comprehensive security assessment.",
|
|
689
|
+
description="[SECURITY] Analyze AUR package metadata for trustworthiness and security indicators. Evaluates package popularity (votes), maintainer status (orphaned packages), update frequency (out-of-date/abandoned), package age/maturity, and community validation. Returns trust score (0-100) with risk factors and trust indicators. Use this alongside PKGBUILD analysis for comprehensive security assessment.",
|
|
616
690
|
inputSchema={
|
|
617
691
|
"type": "object",
|
|
618
692
|
"properties": {
|
|
@@ -622,13 +696,14 @@ async def list_tools() -> list[Tool]:
|
|
|
622
696
|
}
|
|
623
697
|
},
|
|
624
698
|
"required": ["package_info"]
|
|
625
|
-
}
|
|
699
|
+
},
|
|
700
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
626
701
|
),
|
|
627
702
|
|
|
628
703
|
# Package Removal Tools
|
|
629
704
|
Tool(
|
|
630
705
|
name="remove_package",
|
|
631
|
-
description="Remove a package from the system. Supports various removal strategies: basic removal, removal with dependencies, or forced removal. Only works on Arch Linux. Requires sudo access.",
|
|
706
|
+
description="[LIFECYCLE] Remove a package from the system. Supports various removal strategies: basic removal, removal with dependencies, or forced removal. Only works on Arch Linux. Requires sudo access.",
|
|
632
707
|
inputSchema={
|
|
633
708
|
"type": "object",
|
|
634
709
|
"properties": {
|
|
@@ -648,12 +723,13 @@ async def list_tools() -> list[Tool]:
|
|
|
648
723
|
}
|
|
649
724
|
},
|
|
650
725
|
"required": ["package_name"]
|
|
651
|
-
}
|
|
726
|
+
},
|
|
727
|
+
annotations=ToolAnnotations(destructiveHint=True)
|
|
652
728
|
),
|
|
653
729
|
|
|
654
730
|
Tool(
|
|
655
731
|
name="remove_packages_batch",
|
|
656
|
-
description="Remove multiple packages in a single transaction. More efficient than removing packages one by one. Only works on Arch Linux. Requires sudo access.",
|
|
732
|
+
description="[LIFECYCLE] Remove multiple packages in a single transaction. More efficient than removing packages one by one. Only works on Arch Linux. Requires sudo access.",
|
|
657
733
|
inputSchema={
|
|
658
734
|
"type": "object",
|
|
659
735
|
"properties": {
|
|
@@ -669,22 +745,24 @@ async def list_tools() -> list[Tool]:
|
|
|
669
745
|
}
|
|
670
746
|
},
|
|
671
747
|
"required": ["package_names"]
|
|
672
|
-
}
|
|
748
|
+
},
|
|
749
|
+
annotations=ToolAnnotations(destructiveHint=True)
|
|
673
750
|
),
|
|
674
751
|
|
|
675
752
|
# Orphan Package Management
|
|
676
753
|
Tool(
|
|
677
754
|
name="list_orphan_packages",
|
|
678
|
-
description="List all orphaned packages (dependencies no longer required by any installed package). Shows package names and total disk space usage. Only works on Arch Linux.",
|
|
755
|
+
description="[MAINTENANCE] List all orphaned packages (dependencies no longer required by any installed package). Shows package names and total disk space usage. Only works on Arch Linux.",
|
|
679
756
|
inputSchema={
|
|
680
757
|
"type": "object",
|
|
681
758
|
"properties": {}
|
|
682
|
-
}
|
|
759
|
+
},
|
|
760
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
683
761
|
),
|
|
684
762
|
|
|
685
763
|
Tool(
|
|
686
764
|
name="remove_orphans",
|
|
687
|
-
description="Remove all orphaned packages to free up disk space. Supports dry-run mode to preview changes and package exclusion. Only works on Arch Linux. Requires sudo access.",
|
|
765
|
+
description="[MAINTENANCE] Remove all orphaned packages to free up disk space. Supports dry-run mode to preview changes and package exclusion. Only works on Arch Linux. Requires sudo access.",
|
|
688
766
|
inputSchema={
|
|
689
767
|
"type": "object",
|
|
690
768
|
"properties": {
|
|
@@ -700,13 +778,14 @@ async def list_tools() -> list[Tool]:
|
|
|
700
778
|
}
|
|
701
779
|
},
|
|
702
780
|
"required": []
|
|
703
|
-
}
|
|
781
|
+
},
|
|
782
|
+
annotations=ToolAnnotations(destructiveHint=True)
|
|
704
783
|
),
|
|
705
784
|
|
|
706
785
|
# Package Ownership Tools
|
|
707
786
|
Tool(
|
|
708
787
|
name="find_package_owner",
|
|
709
|
-
description="Find which package owns a specific file on the system. Useful for troubleshooting and understanding file origins. Only works on Arch Linux.",
|
|
788
|
+
description="[ORGANIZATION] Find which package owns a specific file on the system. Useful for troubleshooting and understanding file origins. Only works on Arch Linux.",
|
|
710
789
|
inputSchema={
|
|
711
790
|
"type": "object",
|
|
712
791
|
"properties": {
|
|
@@ -716,12 +795,13 @@ async def list_tools() -> list[Tool]:
|
|
|
716
795
|
}
|
|
717
796
|
},
|
|
718
797
|
"required": ["file_path"]
|
|
719
|
-
}
|
|
798
|
+
},
|
|
799
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
720
800
|
),
|
|
721
801
|
|
|
722
802
|
Tool(
|
|
723
803
|
name="list_package_files",
|
|
724
|
-
description="List all files owned by a package. Supports optional filtering by pattern. Only works on Arch Linux.",
|
|
804
|
+
description="[ORGANIZATION] List all files owned by a package. Supports optional filtering by pattern. Only works on Arch Linux.",
|
|
725
805
|
inputSchema={
|
|
726
806
|
"type": "object",
|
|
727
807
|
"properties": {
|
|
@@ -735,12 +815,13 @@ async def list_tools() -> list[Tool]:
|
|
|
735
815
|
}
|
|
736
816
|
},
|
|
737
817
|
"required": ["package_name"]
|
|
738
|
-
}
|
|
818
|
+
},
|
|
819
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
739
820
|
),
|
|
740
821
|
|
|
741
822
|
Tool(
|
|
742
823
|
name="search_package_files",
|
|
743
|
-
description="Search for files across all packages in repositories. Requires package database sync (pacman -Fy). Only works on Arch Linux.",
|
|
824
|
+
description="[ORGANIZATION] Search for files across all packages in repositories. Requires package database sync (pacman -Fy). Only works on Arch Linux.",
|
|
744
825
|
inputSchema={
|
|
745
826
|
"type": "object",
|
|
746
827
|
"properties": {
|
|
@@ -750,13 +831,14 @@ async def list_tools() -> list[Tool]:
|
|
|
750
831
|
}
|
|
751
832
|
},
|
|
752
833
|
"required": ["filename_pattern"]
|
|
753
|
-
}
|
|
834
|
+
},
|
|
835
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
754
836
|
),
|
|
755
837
|
|
|
756
838
|
# Package Verification
|
|
757
839
|
Tool(
|
|
758
840
|
name="verify_package_integrity",
|
|
759
|
-
description="Verify the integrity of installed package files. Detects modified, missing, or corrupted files. Only works on Arch Linux.",
|
|
841
|
+
description="[MAINTENANCE] Verify the integrity of installed package files. Detects modified, missing, or corrupted files. Only works on Arch Linux.",
|
|
760
842
|
inputSchema={
|
|
761
843
|
"type": "object",
|
|
762
844
|
"properties": {
|
|
@@ -771,22 +853,24 @@ async def list_tools() -> list[Tool]:
|
|
|
771
853
|
}
|
|
772
854
|
},
|
|
773
855
|
"required": ["package_name"]
|
|
774
|
-
}
|
|
856
|
+
},
|
|
857
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
775
858
|
),
|
|
776
859
|
|
|
777
860
|
# Package Groups
|
|
778
861
|
Tool(
|
|
779
862
|
name="list_package_groups",
|
|
780
|
-
description="List all available package groups (e.g., base, base-devel, gnome). Only works on Arch Linux.",
|
|
863
|
+
description="[ORGANIZATION] List all available package groups (e.g., base, base-devel, gnome). Only works on Arch Linux.",
|
|
781
864
|
inputSchema={
|
|
782
865
|
"type": "object",
|
|
783
866
|
"properties": {}
|
|
784
|
-
}
|
|
867
|
+
},
|
|
868
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
785
869
|
),
|
|
786
870
|
|
|
787
871
|
Tool(
|
|
788
872
|
name="list_group_packages",
|
|
789
|
-
description="List all packages in a specific group. Only works on Arch Linux.",
|
|
873
|
+
description="[ORGANIZATION] List all packages in a specific group. Only works on Arch Linux.",
|
|
790
874
|
inputSchema={
|
|
791
875
|
"type": "object",
|
|
792
876
|
"properties": {
|
|
@@ -796,22 +880,24 @@ async def list_tools() -> list[Tool]:
|
|
|
796
880
|
}
|
|
797
881
|
},
|
|
798
882
|
"required": ["group_name"]
|
|
799
|
-
}
|
|
883
|
+
},
|
|
884
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
800
885
|
),
|
|
801
886
|
|
|
802
887
|
# Install Reason Management
|
|
803
888
|
Tool(
|
|
804
889
|
name="list_explicit_packages",
|
|
805
|
-
description="List all packages explicitly installed by the user (not installed as dependencies). Useful for creating backup lists or understanding system composition. Only works on Arch Linux.",
|
|
890
|
+
description="[MAINTENANCE] List all packages explicitly installed by the user (not installed as dependencies). Useful for creating backup lists or understanding system composition. Only works on Arch Linux.",
|
|
806
891
|
inputSchema={
|
|
807
892
|
"type": "object",
|
|
808
893
|
"properties": {}
|
|
809
|
-
}
|
|
894
|
+
},
|
|
895
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
810
896
|
),
|
|
811
897
|
|
|
812
898
|
Tool(
|
|
813
899
|
name="mark_as_explicit",
|
|
814
|
-
description="Mark a package as explicitly installed. Prevents it from being removed as an orphan. Only works on Arch Linux.",
|
|
900
|
+
description="[MAINTENANCE] Mark a package as explicitly installed. Prevents it from being removed as an orphan. Only works on Arch Linux.",
|
|
815
901
|
inputSchema={
|
|
816
902
|
"type": "object",
|
|
817
903
|
"properties": {
|
|
@@ -821,12 +907,13 @@ async def list_tools() -> list[Tool]:
|
|
|
821
907
|
}
|
|
822
908
|
},
|
|
823
909
|
"required": ["package_name"]
|
|
824
|
-
}
|
|
910
|
+
},
|
|
911
|
+
annotations=ToolAnnotations(destructiveHint=True)
|
|
825
912
|
),
|
|
826
913
|
|
|
827
914
|
Tool(
|
|
828
915
|
name="mark_as_dependency",
|
|
829
|
-
description="Mark a package as a dependency. Allows it to be removed as an orphan if no packages depend on it. Only works on Arch Linux.",
|
|
916
|
+
description="[MAINTENANCE] Mark a package as a dependency. Allows it to be removed as an orphan if no packages depend on it. Only works on Arch Linux.",
|
|
830
917
|
inputSchema={
|
|
831
918
|
"type": "object",
|
|
832
919
|
"properties": {
|
|
@@ -836,49 +923,54 @@ async def list_tools() -> list[Tool]:
|
|
|
836
923
|
}
|
|
837
924
|
},
|
|
838
925
|
"required": ["package_name"]
|
|
839
|
-
}
|
|
926
|
+
},
|
|
927
|
+
annotations=ToolAnnotations(destructiveHint=True)
|
|
840
928
|
),
|
|
841
929
|
|
|
842
930
|
# System Diagnostic Tools
|
|
843
931
|
Tool(
|
|
844
932
|
name="get_system_info",
|
|
845
|
-
description="Get comprehensive system information including kernel version, architecture, hostname, uptime, and memory statistics. Works on any system.",
|
|
933
|
+
description="[MONITORING] Get comprehensive system information including kernel version, architecture, hostname, uptime, and memory statistics. Works on any system.",
|
|
846
934
|
inputSchema={
|
|
847
935
|
"type": "object",
|
|
848
936
|
"properties": {}
|
|
849
|
-
}
|
|
937
|
+
},
|
|
938
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
850
939
|
),
|
|
851
940
|
|
|
852
941
|
Tool(
|
|
853
942
|
name="check_disk_space",
|
|
854
|
-
description="Check disk space usage for critical filesystem paths including root, home, var, and pacman cache. Warns when space is low. Works on any system.",
|
|
943
|
+
description="[MONITORING] Check disk space usage for critical filesystem paths including root, home, var, and pacman cache. Warns when space is low. Works on any system.",
|
|
855
944
|
inputSchema={
|
|
856
945
|
"type": "object",
|
|
857
946
|
"properties": {}
|
|
858
|
-
}
|
|
947
|
+
},
|
|
948
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
859
949
|
),
|
|
860
950
|
|
|
861
951
|
Tool(
|
|
862
952
|
name="get_pacman_cache_stats",
|
|
863
|
-
description="Analyze pacman package cache statistics including size, package count, and cache age. Only works on Arch Linux.",
|
|
953
|
+
description="[MONITORING] Analyze pacman package cache statistics including size, package count, and cache age. Only works on Arch Linux.",
|
|
864
954
|
inputSchema={
|
|
865
955
|
"type": "object",
|
|
866
956
|
"properties": {}
|
|
867
|
-
}
|
|
957
|
+
},
|
|
958
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
868
959
|
),
|
|
869
960
|
|
|
870
961
|
Tool(
|
|
871
962
|
name="check_failed_services",
|
|
872
|
-
description="Check for failed systemd services. Useful for diagnosing system issues. Works on systemd-based systems.",
|
|
963
|
+
description="[MONITORING] Check for failed systemd services. Useful for diagnosing system issues. Works on systemd-based systems.",
|
|
873
964
|
inputSchema={
|
|
874
965
|
"type": "object",
|
|
875
966
|
"properties": {}
|
|
876
|
-
}
|
|
967
|
+
},
|
|
968
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
877
969
|
),
|
|
878
970
|
|
|
879
971
|
Tool(
|
|
880
972
|
name="get_boot_logs",
|
|
881
|
-
description="Retrieve recent boot logs from journalctl. Useful for troubleshooting boot issues. Works on systemd-based systems.",
|
|
973
|
+
description="[MONITORING] Retrieve recent boot logs from journalctl. Useful for troubleshooting boot issues. Works on systemd-based systems.",
|
|
882
974
|
inputSchema={
|
|
883
975
|
"type": "object",
|
|
884
976
|
"properties": {
|
|
@@ -889,13 +981,14 @@ async def list_tools() -> list[Tool]:
|
|
|
889
981
|
}
|
|
890
982
|
},
|
|
891
983
|
"required": []
|
|
892
|
-
}
|
|
984
|
+
},
|
|
985
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
893
986
|
),
|
|
894
987
|
|
|
895
988
|
# News Tools
|
|
896
989
|
Tool(
|
|
897
990
|
name="get_latest_news",
|
|
898
|
-
description="Fetch recent Arch Linux news from RSS feed. Returns title, date, summary, and link for each news item.",
|
|
991
|
+
description="[DISCOVERY] Fetch recent Arch Linux news from RSS feed. Returns title, date, summary, and link for each news item.",
|
|
899
992
|
inputSchema={
|
|
900
993
|
"type": "object",
|
|
901
994
|
"properties": {
|
|
@@ -910,12 +1003,13 @@ async def list_tools() -> list[Tool]:
|
|
|
910
1003
|
}
|
|
911
1004
|
},
|
|
912
1005
|
"required": []
|
|
913
|
-
}
|
|
1006
|
+
},
|
|
1007
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
914
1008
|
),
|
|
915
1009
|
|
|
916
1010
|
Tool(
|
|
917
1011
|
name="check_critical_news",
|
|
918
|
-
description="Check for critical Arch Linux news requiring manual intervention. Scans recent news for keywords: 'manual intervention', 'action required', 'breaking change', etc.",
|
|
1012
|
+
description="[DISCOVERY] Check for critical Arch Linux news requiring manual intervention. Scans recent news for keywords: 'manual intervention', 'action required', 'breaking change', etc.",
|
|
919
1013
|
inputSchema={
|
|
920
1014
|
"type": "object",
|
|
921
1015
|
"properties": {
|
|
@@ -926,22 +1020,24 @@ async def list_tools() -> list[Tool]:
|
|
|
926
1020
|
}
|
|
927
1021
|
},
|
|
928
1022
|
"required": []
|
|
929
|
-
}
|
|
1023
|
+
},
|
|
1024
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
930
1025
|
),
|
|
931
1026
|
|
|
932
1027
|
Tool(
|
|
933
1028
|
name="get_news_since_last_update",
|
|
934
|
-
description="Get news posted since last pacman update. Parses /var/log/pacman.log for last update timestamp. Only works on Arch Linux.",
|
|
1029
|
+
description="[DISCOVERY] Get news posted since last pacman update. Parses /var/log/pacman.log for last update timestamp. Only works on Arch Linux.",
|
|
935
1030
|
inputSchema={
|
|
936
1031
|
"type": "object",
|
|
937
1032
|
"properties": {}
|
|
938
|
-
}
|
|
1033
|
+
},
|
|
1034
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
939
1035
|
),
|
|
940
1036
|
|
|
941
1037
|
# Transaction Log Tools
|
|
942
1038
|
Tool(
|
|
943
1039
|
name="get_transaction_history",
|
|
944
|
-
description="Get recent package transactions from pacman log. Shows installed, upgraded, and removed packages. Only works on Arch Linux.",
|
|
1040
|
+
description="[HISTORY] Get recent package transactions from pacman log. Shows installed, upgraded, and removed packages. Only works on Arch Linux.",
|
|
945
1041
|
inputSchema={
|
|
946
1042
|
"type": "object",
|
|
947
1043
|
"properties": {
|
|
@@ -958,12 +1054,13 @@ async def list_tools() -> list[Tool]:
|
|
|
958
1054
|
}
|
|
959
1055
|
},
|
|
960
1056
|
"required": []
|
|
961
|
-
}
|
|
1057
|
+
},
|
|
1058
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
962
1059
|
),
|
|
963
1060
|
|
|
964
1061
|
Tool(
|
|
965
1062
|
name="find_when_installed",
|
|
966
|
-
description="Find when a package was first installed and its upgrade history. Only works on Arch Linux.",
|
|
1063
|
+
description="[HISTORY] Find when a package was first installed and its upgrade history. Only works on Arch Linux.",
|
|
967
1064
|
inputSchema={
|
|
968
1065
|
"type": "object",
|
|
969
1066
|
"properties": {
|
|
@@ -973,21 +1070,23 @@ async def list_tools() -> list[Tool]:
|
|
|
973
1070
|
}
|
|
974
1071
|
},
|
|
975
1072
|
"required": ["package_name"]
|
|
976
|
-
}
|
|
1073
|
+
},
|
|
1074
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
977
1075
|
),
|
|
978
1076
|
|
|
979
1077
|
Tool(
|
|
980
1078
|
name="find_failed_transactions",
|
|
981
|
-
description="Find failed package transactions in pacman log. Only works on Arch Linux.",
|
|
1079
|
+
description="[HISTORY] Find failed package transactions in pacman log. Only works on Arch Linux.",
|
|
982
1080
|
inputSchema={
|
|
983
1081
|
"type": "object",
|
|
984
1082
|
"properties": {}
|
|
985
|
-
}
|
|
1083
|
+
},
|
|
1084
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
986
1085
|
),
|
|
987
1086
|
|
|
988
1087
|
Tool(
|
|
989
1088
|
name="get_database_sync_history",
|
|
990
|
-
description="Get database synchronization history. Shows when 'pacman -Sy' was run. Only works on Arch Linux.",
|
|
1089
|
+
description="[HISTORY] Get database synchronization history. Shows when 'pacman -Sy' was run. Only works on Arch Linux.",
|
|
991
1090
|
inputSchema={
|
|
992
1091
|
"type": "object",
|
|
993
1092
|
"properties": {
|
|
@@ -998,22 +1097,24 @@ async def list_tools() -> list[Tool]:
|
|
|
998
1097
|
}
|
|
999
1098
|
},
|
|
1000
1099
|
"required": []
|
|
1001
|
-
}
|
|
1100
|
+
},
|
|
1101
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1002
1102
|
),
|
|
1003
1103
|
|
|
1004
1104
|
# Mirror Management Tools
|
|
1005
1105
|
Tool(
|
|
1006
1106
|
name="list_active_mirrors",
|
|
1007
|
-
description="List currently configured mirrors from mirrorlist. Only works on Arch Linux.",
|
|
1107
|
+
description="[MIRRORS] List currently configured mirrors from mirrorlist. Only works on Arch Linux.",
|
|
1008
1108
|
inputSchema={
|
|
1009
1109
|
"type": "object",
|
|
1010
1110
|
"properties": {}
|
|
1011
|
-
}
|
|
1111
|
+
},
|
|
1112
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1012
1113
|
),
|
|
1013
1114
|
|
|
1014
1115
|
Tool(
|
|
1015
1116
|
name="test_mirror_speed",
|
|
1016
|
-
description="Test mirror response time. Can test a specific mirror or all active mirrors. Only works on Arch Linux.",
|
|
1117
|
+
description="[MIRRORS] Test mirror response time. Can test a specific mirror or all active mirrors. Only works on Arch Linux.",
|
|
1017
1118
|
inputSchema={
|
|
1018
1119
|
"type": "object",
|
|
1019
1120
|
"properties": {
|
|
@@ -1023,12 +1124,13 @@ async def list_tools() -> list[Tool]:
|
|
|
1023
1124
|
}
|
|
1024
1125
|
},
|
|
1025
1126
|
"required": []
|
|
1026
|
-
}
|
|
1127
|
+
},
|
|
1128
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1027
1129
|
),
|
|
1028
1130
|
|
|
1029
1131
|
Tool(
|
|
1030
1132
|
name="suggest_fastest_mirrors",
|
|
1031
|
-
description="Suggest optimal mirrors based on official mirror status from archlinux.org. Filters by country if specified.",
|
|
1133
|
+
description="[MIRRORS] Suggest optimal mirrors based on official mirror status from archlinux.org. Filters by country if specified.",
|
|
1032
1134
|
inputSchema={
|
|
1033
1135
|
"type": "object",
|
|
1034
1136
|
"properties": {
|
|
@@ -1043,62 +1145,79 @@ async def list_tools() -> list[Tool]:
|
|
|
1043
1145
|
}
|
|
1044
1146
|
},
|
|
1045
1147
|
"required": []
|
|
1046
|
-
}
|
|
1148
|
+
},
|
|
1149
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1047
1150
|
),
|
|
1048
1151
|
|
|
1049
1152
|
Tool(
|
|
1050
1153
|
name="check_mirrorlist_health",
|
|
1051
|
-
description="Verify mirror configuration health. Checks for common issues like no active mirrors, outdated mirrorlist, high latency. Only works on Arch Linux.",
|
|
1154
|
+
description="[MIRRORS] Verify mirror configuration health. Checks for common issues like no active mirrors, outdated mirrorlist, high latency. Only works on Arch Linux.",
|
|
1052
1155
|
inputSchema={
|
|
1053
1156
|
"type": "object",
|
|
1054
1157
|
"properties": {}
|
|
1055
|
-
}
|
|
1158
|
+
},
|
|
1159
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1056
1160
|
),
|
|
1057
1161
|
|
|
1058
1162
|
# Configuration Tools
|
|
1059
1163
|
Tool(
|
|
1060
1164
|
name="analyze_pacman_conf",
|
|
1061
|
-
description="Parse and analyze pacman.conf. Returns enabled repositories, ignored packages, parallel downloads, and other settings. Only works on Arch Linux.",
|
|
1165
|
+
description="[CONFIG] Parse and analyze pacman.conf. Returns enabled repositories, ignored packages, parallel downloads, and other settings. Only works on Arch Linux.",
|
|
1062
1166
|
inputSchema={
|
|
1063
1167
|
"type": "object",
|
|
1064
1168
|
"properties": {}
|
|
1065
|
-
}
|
|
1169
|
+
},
|
|
1170
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1066
1171
|
),
|
|
1067
1172
|
|
|
1068
1173
|
Tool(
|
|
1069
1174
|
name="analyze_makepkg_conf",
|
|
1070
|
-
description="Parse and analyze makepkg.conf. Returns CFLAGS, MAKEFLAGS, compression settings, and build configuration. Only works on Arch Linux.",
|
|
1175
|
+
description="[CONFIG] Parse and analyze makepkg.conf. Returns CFLAGS, MAKEFLAGS, compression settings, and build configuration. Only works on Arch Linux.",
|
|
1071
1176
|
inputSchema={
|
|
1072
1177
|
"type": "object",
|
|
1073
1178
|
"properties": {}
|
|
1074
|
-
}
|
|
1179
|
+
},
|
|
1180
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1075
1181
|
),
|
|
1076
1182
|
|
|
1077
1183
|
Tool(
|
|
1078
1184
|
name="check_ignored_packages",
|
|
1079
|
-
description="List packages ignored in updates from pacman.conf. Warns if critical system packages are ignored. Only works on Arch Linux.",
|
|
1185
|
+
description="[CONFIG] List packages ignored in updates from pacman.conf. Warns if critical system packages are ignored. Only works on Arch Linux.",
|
|
1080
1186
|
inputSchema={
|
|
1081
1187
|
"type": "object",
|
|
1082
1188
|
"properties": {}
|
|
1083
|
-
}
|
|
1189
|
+
},
|
|
1190
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1084
1191
|
),
|
|
1085
1192
|
|
|
1086
1193
|
Tool(
|
|
1087
1194
|
name="get_parallel_downloads_setting",
|
|
1088
|
-
description="Get parallel downloads configuration from pacman.conf and provide recommendations. Only works on Arch Linux.",
|
|
1195
|
+
description="[CONFIG] Get parallel downloads configuration from pacman.conf and provide recommendations. Only works on Arch Linux.",
|
|
1089
1196
|
inputSchema={
|
|
1090
1197
|
"type": "object",
|
|
1091
1198
|
"properties": {}
|
|
1092
|
-
}
|
|
1199
|
+
},
|
|
1200
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1093
1201
|
),
|
|
1094
1202
|
|
|
1095
1203
|
Tool(
|
|
1096
1204
|
name="check_database_freshness",
|
|
1097
|
-
description="Check when package databases were last synchronized. Warns if databases are stale (> 24 hours). Only works on Arch Linux.",
|
|
1205
|
+
description="[MAINTENANCE] Check when package databases were last synchronized. Warns if databases are stale (> 24 hours). Only works on Arch Linux.",
|
|
1098
1206
|
inputSchema={
|
|
1099
1207
|
"type": "object",
|
|
1100
1208
|
"properties": {}
|
|
1101
|
-
}
|
|
1209
|
+
},
|
|
1210
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1211
|
+
),
|
|
1212
|
+
|
|
1213
|
+
Tool(
|
|
1214
|
+
name="run_system_health_check",
|
|
1215
|
+
description="[MONITORING] Run a comprehensive system health check. Integrates multiple diagnostics to provide a complete overview of system status, including disk space, failed services, updates, orphan packages, and more. Only works on Arch Linux.",
|
|
1216
|
+
inputSchema={
|
|
1217
|
+
"type": "object",
|
|
1218
|
+
"properties": {}
|
|
1219
|
+
},
|
|
1220
|
+
annotations=ToolAnnotations(readOnlyHint=True)
|
|
1102
1221
|
),
|
|
1103
1222
|
]
|
|
1104
1223
|
|
|
@@ -1413,6 +1532,13 @@ async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent |
|
|
|
1413
1532
|
|
|
1414
1533
|
result = await get_parallel_downloads_setting()
|
|
1415
1534
|
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
|
1535
|
+
|
|
1536
|
+
elif name == "run_system_health_check":
|
|
1537
|
+
if not IS_ARCH:
|
|
1538
|
+
return [TextContent(type="text", text="Error: run_system_health_check only available on Arch Linux systems")]
|
|
1539
|
+
|
|
1540
|
+
result = await run_system_health_check()
|
|
1541
|
+
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
|
1416
1542
|
|
|
1417
1543
|
elif name == "check_database_freshness":
|
|
1418
1544
|
if not IS_ARCH:
|
|
@@ -1481,6 +1607,44 @@ async def list_prompts() -> list[Prompt]:
|
|
|
1481
1607
|
description="Enhanced system update workflow that checks for critical news, disk space, and failed services before updating",
|
|
1482
1608
|
arguments=[]
|
|
1483
1609
|
),
|
|
1610
|
+
Prompt(
|
|
1611
|
+
name="cleanup_system",
|
|
1612
|
+
description="Comprehensive system cleanup workflow: remove orphans, clean cache, verify integrity",
|
|
1613
|
+
arguments=[
|
|
1614
|
+
{
|
|
1615
|
+
"name": "aggressive",
|
|
1616
|
+
"description": "Perform aggressive cleanup (removes more packages). Default: false",
|
|
1617
|
+
"required": False
|
|
1618
|
+
}
|
|
1619
|
+
]
|
|
1620
|
+
),
|
|
1621
|
+
Prompt(
|
|
1622
|
+
name="package_investigation",
|
|
1623
|
+
description="Deep package research before installation: check repos, analyze security, review dependencies",
|
|
1624
|
+
arguments=[
|
|
1625
|
+
{
|
|
1626
|
+
"name": "package_name",
|
|
1627
|
+
"description": "Package name to investigate",
|
|
1628
|
+
"required": True
|
|
1629
|
+
}
|
|
1630
|
+
]
|
|
1631
|
+
),
|
|
1632
|
+
Prompt(
|
|
1633
|
+
name="mirror_optimization",
|
|
1634
|
+
description="Test and configure fastest mirrors based on location and latency",
|
|
1635
|
+
arguments=[
|
|
1636
|
+
{
|
|
1637
|
+
"name": "country",
|
|
1638
|
+
"description": "Country code for mirror suggestions (e.g., US, DE, JP)",
|
|
1639
|
+
"required": False
|
|
1640
|
+
}
|
|
1641
|
+
]
|
|
1642
|
+
),
|
|
1643
|
+
Prompt(
|
|
1644
|
+
name="system_health_check",
|
|
1645
|
+
description="Comprehensive system diagnostic: check disk, services, logs, database, integrity",
|
|
1646
|
+
arguments=[]
|
|
1647
|
+
),
|
|
1484
1648
|
]
|
|
1485
1649
|
|
|
1486
1650
|
|
|
@@ -1864,6 +2028,254 @@ paru -S {package_name} # or yay -S {package_name}
|
|
|
1864
2028
|
)
|
|
1865
2029
|
]
|
|
1866
2030
|
)
|
|
1867
|
-
|
|
2031
|
+
|
|
2032
|
+
elif name == "cleanup_system":
|
|
2033
|
+
if not IS_ARCH:
|
|
2034
|
+
return GetPromptResult(
|
|
2035
|
+
description="System cleanup workflow",
|
|
2036
|
+
messages=[
|
|
2037
|
+
PromptMessage(
|
|
2038
|
+
role="assistant",
|
|
2039
|
+
content=PromptMessage.TextContent(
|
|
2040
|
+
type="text",
|
|
2041
|
+
text="Error: cleanup_system prompt only available on Arch Linux systems"
|
|
2042
|
+
)
|
|
2043
|
+
)
|
|
2044
|
+
]
|
|
2045
|
+
)
|
|
2046
|
+
|
|
2047
|
+
aggressive = arguments.get("aggressive", "false").lower() == "true"
|
|
2048
|
+
|
|
2049
|
+
return GetPromptResult(
|
|
2050
|
+
description="System cleanup workflow",
|
|
2051
|
+
messages=[
|
|
2052
|
+
PromptMessage(
|
|
2053
|
+
role="user",
|
|
2054
|
+
content=PromptMessage.TextContent(
|
|
2055
|
+
type="text",
|
|
2056
|
+
text=f"""Please perform a comprehensive system cleanup:
|
|
2057
|
+
|
|
2058
|
+
1. **Check Orphaned Packages**:
|
|
2059
|
+
- Run list_orphan_packages
|
|
2060
|
+
- Review the list for packages that can be safely removed
|
|
2061
|
+
{' - Be aggressive: remove all orphans unless critical' if aggressive else ' - Be conservative: keep packages that might be useful'}
|
|
2062
|
+
|
|
2063
|
+
2. **Clean Package Cache**:
|
|
2064
|
+
- Run get_pacman_cache_stats
|
|
2065
|
+
- If cache is > 1GB or has > 100 packages, suggest cleanup
|
|
2066
|
+
- Provide command: sudo pacman -Sc (keep current) or -Scc (remove all)
|
|
2067
|
+
|
|
2068
|
+
3. **Verify Package Integrity**:
|
|
2069
|
+
- Run list_explicit_packages
|
|
2070
|
+
- For critical packages (kernel, systemd, pacman), run verify_package_integrity
|
|
2071
|
+
- Report any modified or missing files
|
|
2072
|
+
|
|
2073
|
+
4. **Check Database Freshness**:
|
|
2074
|
+
- Run check_database_freshness
|
|
2075
|
+
- If database is stale (> 7 days), suggest: sudo pacman -Sy
|
|
2076
|
+
|
|
2077
|
+
5. **Summary**:
|
|
2078
|
+
- Space freed (estimate)
|
|
2079
|
+
- Packages removed
|
|
2080
|
+
- Integrity issues found
|
|
2081
|
+
- Recommended next steps
|
|
2082
|
+
|
|
2083
|
+
Be thorough and explain each step."""
|
|
2084
|
+
)
|
|
2085
|
+
)
|
|
2086
|
+
]
|
|
2087
|
+
)
|
|
2088
|
+
|
|
2089
|
+
elif name == "package_investigation":
|
|
2090
|
+
package_name = arguments.get("package_name", "")
|
|
2091
|
+
|
|
2092
|
+
if not package_name:
|
|
2093
|
+
return GetPromptResult(
|
|
2094
|
+
description="Package investigation workflow",
|
|
2095
|
+
messages=[
|
|
2096
|
+
PromptMessage(
|
|
2097
|
+
role="assistant",
|
|
2098
|
+
content=PromptMessage.TextContent(
|
|
2099
|
+
type="text",
|
|
2100
|
+
text="Error: package_name argument is required"
|
|
2101
|
+
)
|
|
2102
|
+
)
|
|
2103
|
+
]
|
|
2104
|
+
)
|
|
2105
|
+
|
|
2106
|
+
return GetPromptResult(
|
|
2107
|
+
description=f"Deep investigation of package: {package_name}",
|
|
2108
|
+
messages=[
|
|
2109
|
+
PromptMessage(
|
|
2110
|
+
role="user",
|
|
2111
|
+
content=PromptMessage.TextContent(
|
|
2112
|
+
type="text",
|
|
2113
|
+
text=f"""Please investigate the package '{package_name}' thoroughly before installation:
|
|
2114
|
+
|
|
2115
|
+
1. **Check Official Repositories First**:
|
|
2116
|
+
- Run get_official_package_info("{package_name}")
|
|
2117
|
+
- If found in official repos: ✅ SAFE - recommend using pacman
|
|
2118
|
+
- If not found: Continue to AUR investigation
|
|
2119
|
+
|
|
2120
|
+
2. **Search AUR** (if not in official repos):
|
|
2121
|
+
- Run search_aur("{package_name}")
|
|
2122
|
+
- Review: votes, popularity, maintainer, last update
|
|
2123
|
+
- Check for similar packages with better metrics
|
|
2124
|
+
|
|
2125
|
+
3. **Security Analysis**:
|
|
2126
|
+
- For top AUR result, run analyze_package_metadata_risk
|
|
2127
|
+
- Trust score interpretation:
|
|
2128
|
+
- 80-100: Highly trusted
|
|
2129
|
+
- 60-79: Generally safe
|
|
2130
|
+
- 40-59: Review carefully
|
|
2131
|
+
- 0-39: High risk, manual audit required
|
|
2132
|
+
|
|
2133
|
+
4. **PKGBUILD Audit** (if proceeding with AUR):
|
|
2134
|
+
- Fetch PKGBUILD content
|
|
2135
|
+
- Run analyze_pkgbuild_safety
|
|
2136
|
+
- Risk score interpretation:
|
|
2137
|
+
- 0-29: Low risk
|
|
2138
|
+
- 30-59: Medium risk - review findings
|
|
2139
|
+
- 60-100: High risk - DO NOT INSTALL
|
|
2140
|
+
|
|
2141
|
+
5. **Check Dependencies**:
|
|
2142
|
+
- Review makedepends and depends from PKGBUILD
|
|
2143
|
+
- Check if dependencies are in official repos or AUR
|
|
2144
|
+
- Warn about deep AUR dependency chains
|
|
2145
|
+
|
|
2146
|
+
6. **Final Recommendation**:
|
|
2147
|
+
- ✅ Safe to install (with command)
|
|
2148
|
+
- ⚠️ Proceed with caution (explain risks)
|
|
2149
|
+
- ⛔ Do not install (explain why)
|
|
2150
|
+
|
|
2151
|
+
7. **Alternative Suggestions**:
|
|
2152
|
+
- Suggest official repo alternatives if available
|
|
2153
|
+
- Suggest better-maintained AUR packages if found
|
|
2154
|
+
|
|
2155
|
+
Be comprehensive and explain security implications."""
|
|
2156
|
+
)
|
|
2157
|
+
)
|
|
2158
|
+
]
|
|
2159
|
+
)
|
|
2160
|
+
|
|
2161
|
+
elif name == "mirror_optimization":
|
|
2162
|
+
country = arguments.get("country", "")
|
|
2163
|
+
|
|
2164
|
+
return GetPromptResult(
|
|
2165
|
+
description="Mirror optimization workflow",
|
|
2166
|
+
messages=[
|
|
2167
|
+
PromptMessage(
|
|
2168
|
+
role="user",
|
|
2169
|
+
content=PromptMessage.TextContent(
|
|
2170
|
+
type="text",
|
|
2171
|
+
text=f"""Please optimize repository mirrors:
|
|
2172
|
+
|
|
2173
|
+
1. **List Current Mirrors**:
|
|
2174
|
+
- Run list_active_mirrors
|
|
2175
|
+
- Show currently configured mirrors
|
|
2176
|
+
|
|
2177
|
+
2. **Test Current Mirror Performance**:
|
|
2178
|
+
- Run test_mirror_speed (without mirror_url argument to test all)
|
|
2179
|
+
- Show latency for each mirror
|
|
2180
|
+
- Identify slow mirrors (> 500ms)
|
|
2181
|
+
|
|
2182
|
+
3. **Suggest Optimal Mirrors**:
|
|
2183
|
+
- Run suggest_fastest_mirrors{f'(country="{country}")' if country else ''}
|
|
2184
|
+
- Based on geographic location and current status
|
|
2185
|
+
- Show top 10 recommended mirrors
|
|
2186
|
+
|
|
2187
|
+
4. **Health Check**:
|
|
2188
|
+
- Run check_mirrorlist_health
|
|
2189
|
+
- Identify any configuration issues
|
|
2190
|
+
- Check for outdated or unreachable mirrors
|
|
2191
|
+
|
|
2192
|
+
5. **Recommendations**:
|
|
2193
|
+
- Suggest mirror configuration changes
|
|
2194
|
+
- Provide commands to update /etc/pacman.d/mirrorlist
|
|
2195
|
+
- Recommend using reflector or manual configuration
|
|
2196
|
+
|
|
2197
|
+
6. **Expected Benefits**:
|
|
2198
|
+
- Estimate download speed improvements
|
|
2199
|
+
- Reduced update times
|
|
2200
|
+
- Better reliability
|
|
2201
|
+
|
|
2202
|
+
Be detailed and provide specific mirror URLs and configuration commands."""
|
|
2203
|
+
)
|
|
2204
|
+
)
|
|
2205
|
+
]
|
|
2206
|
+
)
|
|
2207
|
+
|
|
2208
|
+
elif name == "system_health_check":
|
|
2209
|
+
if not IS_ARCH:
|
|
2210
|
+
return GetPromptResult(
|
|
2211
|
+
description="System health check",
|
|
2212
|
+
messages=[
|
|
2213
|
+
PromptMessage(
|
|
2214
|
+
role="assistant",
|
|
2215
|
+
content=PromptMessage.TextContent(
|
|
2216
|
+
type="text",
|
|
2217
|
+
text="Error: system_health_check prompt only available on Arch Linux systems"
|
|
2218
|
+
)
|
|
2219
|
+
)
|
|
2220
|
+
]
|
|
2221
|
+
)
|
|
2222
|
+
|
|
2223
|
+
return GetPromptResult(
|
|
2224
|
+
description="Comprehensive system health check",
|
|
2225
|
+
messages=[
|
|
2226
|
+
PromptMessage(
|
|
2227
|
+
role="user",
|
|
2228
|
+
content=PromptMessage.TextContent(
|
|
2229
|
+
type="text",
|
|
2230
|
+
text="""Please perform a comprehensive system health diagnostic:
|
|
2231
|
+
|
|
2232
|
+
1. **System Information**:
|
|
2233
|
+
- Run get_system_info
|
|
2234
|
+
- Review kernel version, uptime, memory usage
|
|
2235
|
+
- Check for abnormalities
|
|
2236
|
+
|
|
2237
|
+
2. **Disk Space Analysis**:
|
|
2238
|
+
- Run check_disk_space
|
|
2239
|
+
- Identify partitions with low space
|
|
2240
|
+
- Run get_pacman_cache_stats
|
|
2241
|
+
- Calculate total reclaimable space
|
|
2242
|
+
|
|
2243
|
+
3. **Service Health**:
|
|
2244
|
+
- Run check_failed_services
|
|
2245
|
+
- List all failed systemd services
|
|
2246
|
+
- If failures found, run get_boot_logs to investigate
|
|
2247
|
+
|
|
2248
|
+
4. **Package Database Health**:
|
|
2249
|
+
- Run check_database_freshness
|
|
2250
|
+
- Check when last synchronized
|
|
2251
|
+
- Run find_failed_transactions
|
|
2252
|
+
- Identify any package operation failures
|
|
2253
|
+
|
|
2254
|
+
5. **Package Integrity**:
|
|
2255
|
+
- Run list_orphan_packages
|
|
2256
|
+
- Count orphaned packages and space used
|
|
2257
|
+
- Suggest running verify_package_integrity on critical packages
|
|
2258
|
+
|
|
2259
|
+
6. **Configuration Health**:
|
|
2260
|
+
- Run analyze_pacman_conf
|
|
2261
|
+
- Run check_ignored_packages
|
|
2262
|
+
- Warn about critical packages being ignored
|
|
2263
|
+
|
|
2264
|
+
7. **Mirror Health**:
|
|
2265
|
+
- Run check_mirrorlist_health
|
|
2266
|
+
- Identify mirror issues
|
|
2267
|
+
|
|
2268
|
+
8. **Summary Report**:
|
|
2269
|
+
- Overall health status (Healthy/Warnings/Critical)
|
|
2270
|
+
- List of issues found with severity levels
|
|
2271
|
+
- Prioritized recommendations for fixes
|
|
2272
|
+
- Estimate of system optimization potential
|
|
2273
|
+
|
|
2274
|
+
Be thorough and provide actionable recommendations with specific commands."""
|
|
2275
|
+
)
|
|
2276
|
+
)
|
|
2277
|
+
]
|
|
2278
|
+
)
|
|
2279
|
+
|
|
1868
2280
|
else:
|
|
1869
2281
|
raise ValueError(f"Unknown prompt: {name}")
|