You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Return default tool name if there's any error parsing the URL
741
+
return"search_documentation";
742
+
}
743
+
}
744
+
745
+
/**
746
+
* Generate a dynamic description for the search_documentation tool based on the URL
747
+
* @param requestHost - The host from the request
748
+
* @param requestUrl - The full request URL (optional)
749
+
* @returns A descriptive string for the tool
750
+
*/
751
+
exportfunctiongenerateSearchToolDescription({
752
+
urlType,
753
+
owner,
754
+
repo,
755
+
}: RepoData): string{
756
+
try{
757
+
constfetchToolName=generateFetchToolName({
758
+
urlType,
759
+
owner,
760
+
repo,
761
+
});
762
+
763
+
// Default description as fallback
764
+
letdescription=
765
+
"Semantically search within the fetched documentation for the current repository.";
766
+
767
+
if(urlType=="subdomain"){
768
+
description=`Semantically search within the fetched documentation from the ${owner}/${repo} GitHub Pages. Useful for specific queries. Don't call if you already used ${fetchToolName}.`;
769
+
}elseif(urlType=="github"){
770
+
description=`Semantically search within the fetched documentation from GitHub repository: ${owner}/${repo}. Useful for specific queries. Don't call if you already used ${fetchToolName}.`;
771
+
}
772
+
773
+
returndescription;
774
+
}catch(error){
775
+
// Return default description if there's any error parsing the URL
776
+
return"Search documentation for the current repository.";
777
+
}
778
+
}
779
+
780
+
/**
781
+
* Generate a dynamic description for the fetch_documentation tool based on the URL
782
+
* @param requestHost - The host from the request
783
+
* @param requestUrl - The full request URL (optional)
784
+
* @returns A descriptive string for the tool
785
+
*/
786
+
exportfunctiongenerateFetchToolDescription({
787
+
urlType,
788
+
owner,
789
+
repo,
790
+
}: Omit<RepoData,"host">): string{
791
+
try{
792
+
// Default description as fallback
793
+
letdescription="Fetch entire documentation for the current repository.";
794
+
795
+
if(urlType=="subdomain"){
796
+
description=`Fetch entire documentation file from the ${owner}/${repo} GitHub Pages. Useful for general questions.`;
797
+
}elseif(urlType=="github"){
798
+
description=`Fetch entire documentation file from GitHub repository: ${owner}/${repo}. Useful for general questions.`;
799
+
}
800
+
801
+
returndescription;
802
+
}catch(error){
803
+
// Return default description if there's any error parsing the URL
804
+
return"Fetch documentation for the current repository.";
805
+
}
806
+
}
807
+
808
+
/**
809
+
* Generate a dynamic tool name for the fetch_documentation tool based on the URL
810
+
* @param requestHost - The host from the request
811
+
* @param requestUrl - The full request URL (optional)
812
+
* @returns A descriptive string for the tool
813
+
*/
814
+
exportfunctiongenerateFetchToolName({
815
+
urlType,
816
+
owner,
817
+
repo,
818
+
}: Omit<RepoData,"host">): string{
819
+
try{
820
+
// Default tool name as fallback
821
+
lettoolName="fetch_documentation";
822
+
823
+
if(urlType=="subdomain"||urlType=="github"){
824
+
// Use enforceLengthLimit to ensure the tool name doesn't exceed 60 characters
0 commit comments