/**
 * @fileoverview Tool definition types and `tool()` builder function.
 * Provides the canonical `ToolDefinition` interface and `ToolAnnotations` type
 * used by all tool definitions and the handler factory.
 *
 * Also re-exports `disabledTool()` and `DisabledMetadata` so consumers can
 * import the wrapper from the same `/tools` subpath as the builder.
 * @module src/mcp-server/tools/utils/toolDefinition
 */
export { disabledTool } from './disabled-tool.js';
// ---------------------------------------------------------------------------
// Builder
// ---------------------------------------------------------------------------
/**
 * Creates a tool definition with full type inference from Zod schemas.
 *
 * The `const` modifier on `TErrors` preserves literal types in the `errors[]`
 * array without requiring `as const` at the call site, so the reason union
 * flows into `ctx.fail` automatically.
 *
 * @example Without an error contract — throw `McpError` directly:
 * ```ts
 * const myTool = tool('my_tool', {
 *   description: 'Does something useful.',
 *   input: z.object({ query: z.string().describe('Search query') }),
 *   output: z.object({
 *     items: z.array(z.object({
 *       id: z.string().describe('Item ID'),
 *       name: z.string().describe('Item name'),
 *     })).describe('Matching items'),
 *   }),
 *   async handler(input, ctx) {
 *     if (!input.query) throw notFound('Empty query');
 *     return { items: await search(input.query) };
 *   },
 * });
 * ```
 *
 * @example With a typed error contract — `ctx.fail(reason, …)`:
 * ```ts
 * const myTool = tool('my_tool', {
 *   errors: [
 *     { reason: 'no_match', code: JsonRpcErrorCode.NotFound,
 *       when: 'No items match the query',
 *       recovery: 'Broaden the query or check the spelling and try again.' },
 *     { reason: 'rate_limited', code: JsonRpcErrorCode.RateLimited,
 *       when: 'Upstream rate limit hit', retryable: true,
 *       recovery: 'Wait a few seconds before retrying or reduce request frequency.' },
 *   ],
 *   input: z.object({ query: z.string().describe('Search query') }),
 *   output: z.object({ items: z.array(z.string()).describe('Matched items') }),
 *   async handler(input, ctx) {
 *     const items = await search(input.query);
 *     if (items.length === 0) throw ctx.fail('no_match', `No matches for "${input.query}"`);
 *     // ctx.fail('typo')  ← TypeScript error: 'typo' isn't in the contract
 *     return { items };
 *   },
 * });
 * ```
 */
export function tool(name, options) {
    return { name, ...options };
}
//# sourceMappingURL=toolDefinition.js.map