refactor: add sdk tool type exports

This commit is contained in:
2026-04-03 13:39:56 +08:00
parent 097bc753f0
commit af2f2b0e34

23
src/entrypoints/sdk/toolTypes.ts Executable file → Normal file
View File

@@ -1 +1,22 @@
export {}
import type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'
import type { AnyZodRawShape, InferShape, SdkMcpToolDefinition } from './runtimeTypes.ts'
export type { AnyZodRawShape, InferShape, SdkMcpToolDefinition }
export type SdkMcpToolHandler<Schema extends AnyZodRawShape> = (
args: InferShape<Schema>,
extra: unknown,
) => Promise<CallToolResult>
export type SdkMcpToolExtras = {
annotations?: ToolAnnotations
searchHint?: string
alwaysLoad?: boolean
}
export type SdkMcpToolDescriptor<Schema extends AnyZodRawShape> = Pick<
SdkMcpToolDefinition<Schema>,
'name' | 'description' | 'inputSchema' | 'handler'
> &
SdkMcpToolExtras