| 71 | |
| 72 | // Returns the execution.taskSupport value for a tool, defaulting to "forbidden" per MCP spec |
| 73 | const getTaskSupport = ( |
| 74 | tool: Tool | null, |
| 75 | ): "forbidden" | "required" | "optional" => { |
| 76 | if (!tool) return "forbidden"; |
| 77 | const extendedTool = tool as ExtendedTool; |
| 78 | const taskSupport = extendedTool.execution?.taskSupport; |
| 79 | if ( |
| 80 | taskSupport === "forbidden" || |
| 81 | taskSupport === "required" || |
| 82 | taskSupport === "optional" |
| 83 | ) { |
| 84 | return taskSupport; |
| 85 | } |
| 86 | return "forbidden"; |
| 87 | }; |
| 88 | |
| 89 | // Type guard to safely detect the optional annotations field |
| 90 | const hasAnnotations = ( |