| 911 | * @returns A descriptive string for the tool |
| 912 | */ |
| 913 | export function generateFetchToolDescription({ |
| 914 | urlType, |
| 915 | owner, |
| 916 | repo, |
| 917 | }: Omit<RepoData, "host">): string { |
| 918 | try { |
| 919 | // Default description as fallback |
| 920 | let description = "Fetch entire documentation for the current repository."; |
| 921 | |
| 922 | if (urlType == "subdomain") { |
| 923 | description = `Fetch entire documentation file from the ${owner}/${repo} GitHub Pages. Useful for general questions. Always call this tool first if asked about ${owner}/${repo}.`; |
| 924 | } else if (urlType == "github") { |
| 925 | description = `Fetch entire documentation file from GitHub repository: ${owner}/${repo}. Useful for general questions. Always call this tool first if asked about ${owner}/${repo}.`; |
| 926 | } |
| 927 | |
| 928 | return description; |
| 929 | } catch (error) { |
| 930 | // Return default description if there's any error parsing the URL |
| 931 | return "Fetch documentation for the current repository."; |
| 932 | } |
| 933 | } |
| 934 | |
| 935 | /** |
| 936 | * Generate a dynamic tool name for the fetch_documentation tool based on the URL |