getYesOrNo
Answer yes-or-no questions by analyzing input queries to provide binary responses for decision-making scenarios.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes |
Implementation Reference
- stdio-example.ts:15-24 (handler)The handler function for the 'getYesOrNo' tool. It takes a 'question' parameter and randomly returns either 'YES' or 'NO' as text content.async ({ question }) => { return { content: [ { type: "text", text: Math.random() > 0.5 ? "YES" : "NO", }, ], }; },
- stdio-example.ts:12-14 (schema)Input schema for the 'getYesOrNo' tool, defining a required 'question' string parameter.{ question: z.string(), },
- stdio-example.ts:10-25 (registration)Registration of the 'getYesOrNo' tool using server.tool(), including schema and inline handler.server.tool( "getYesOrNo", { question: z.string(), }, async ({ question }) => { return { content: [ { type: "text", text: Math.random() > 0.5 ? "YES" : "NO", }, ], }; }, );