@mcpbr/core
Version:
Core functions for mcpbr
37 lines (33 loc) • 1.63 kB
text/typescript
import { Tool as Tool$1 } from '@modelcontextprotocol/sdk/types.js';
import { z } from 'zod';
type Tool = Tool$1;
type CoreTool = {
definition: Tool;
handler: (params: Record<string, unknown>, args: Record<string, unknown>) => Promise<{
content: {
type: string;
text: string;
}[];
isError?: boolean;
}>;
};
declare function mcpServerFactory(meta: {
name: string;
version: string;
}, params: Record<string, unknown>): {
make: (tools: CoreTool[]) => void;
start: () => void;
};
type EmptyObject = {};
type McpInputSchema = z.ZodObject<{
type: z.ZodLiteral<'object'>;
properties: z.ZodOptional<z.ZodObject<EmptyObject, 'passthrough', z.ZodTypeAny, z.objectOutputType<EmptyObject, z.ZodTypeAny, 'passthrough'>, z.objectInputType<EmptyObject, z.ZodTypeAny, 'passthrough'>>>;
}, 'passthrough', z.ZodTypeAny, z.objectOutputType<{
type: z.ZodLiteral<'object'>;
properties: z.ZodOptional<z.ZodObject<EmptyObject, 'passthrough', z.ZodTypeAny, z.objectOutputType<EmptyObject, z.ZodTypeAny, 'passthrough'>, z.objectInputType<EmptyObject, z.ZodTypeAny, 'passthrough'>>>;
}, z.ZodTypeAny, 'passthrough'>, z.objectInputType<{
type: z.ZodLiteral<'object'>;
properties: z.ZodOptional<z.ZodObject<EmptyObject, 'passthrough', z.ZodTypeAny, z.objectOutputType<EmptyObject, z.ZodTypeAny, 'passthrough'>, z.objectInputType<EmptyObject, z.ZodTypeAny, 'passthrough'>>>;
}, z.ZodTypeAny, 'passthrough'>>;
declare function toJsonSchema<T>(schema: z.Schema): z.infer<McpInputSchema>;
export { type CoreTool, type Tool, mcpServerFactory, toJsonSchema };