check for the prompt capability before listing prompts from MCP servers (#5616)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Sandy Tao <sandytao520@icloud.com>
This commit is contained in:
Jacob MacDonald
2025-08-05 15:50:30 -07:00
committed by GitHub
parent aebe3ace3c
commit 6a72cd064b
2 changed files with 45 additions and 9 deletions

View File

@@ -496,6 +496,9 @@ export async function discoverPrompts(
promptRegistry: PromptRegistry,
): Promise<Prompt[]> {
try {
// Only request prompts if the server supports them.
if (mcpClient.getServerCapabilities()?.prompts == null) return [];
const response = await mcpClient.request(
{ method: 'prompts/list', params: {} },
ListPromptsResultSchema,