modality-kit 0.12.20 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -16,30 +16,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
16
16
  throw Error('Dynamic require of "' + x + '" is not supported');
17
17
  });
18
18
 
19
- // src/util_mcp_tools_converter.ts
20
- class ModalityFastMCP {
21
- tools = new Map;
22
- addTool(tool) {
23
- this.tools.set(tool.name, tool);
24
- }
25
- getTools() {
26
- return Array.from(this.tools.values());
27
- }
28
- }
29
- var setupAITools = (aiTools, mcpServer) => {
30
- if (mcpServer) {
31
- Object.entries(aiTools).forEach(([toolName, aiTool]) => {
32
- let name = aiTool.name != null ? aiTool.name : toolName;
33
- const { inputSchema, ...restAITool } = aiTool;
34
- mcpServer.addTool({
35
- ...restAITool,
36
- parameters: inputSchema,
37
- name
38
- });
39
- });
40
- }
41
- return aiTools;
42
- };
43
19
  // src/util_logger.ts
44
20
  var levels = [null, "debug", "info", "warn", "error", "success"];
45
21
 
@@ -5951,7 +5927,6 @@ class LruCache {
5951
5927
  }
5952
5928
  export {
5953
5929
  withErrorHandling,
5954
- setupAITools,
5955
5930
  loadVersion,
5956
5931
  isTestEnvironment,
5957
5932
  getLoggerInstance,
@@ -5962,7 +5937,6 @@ export {
5962
5937
  compressWithLanguageDetection as compressText,
5963
5938
  WebSocketClient,
5964
5939
  exports_schemas_symbol as SymbolTypes,
5965
- ModalityFastMCP,
5966
5940
  LruCache,
5967
5941
  JSONRPCUtils,
5968
5942
  JSONRPCManager,
@@ -1,5 +1,3 @@
1
- export { setupAITools, ModalityFastMCP } from "./util_mcp_tools_converter";
2
- export type { AITools, AITool, FastMCPTool, } from "./schemas/schemas_tool_config";
3
1
  export { formatErrorResponse, formatSuccessResponse } from "./util_response";
4
2
  export { getLoggerInstance, type ModalityLogger } from "./util_logger";
5
3
  export { withErrorHandling, ErrorCode } from "./util_error";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.12.20",
2
+ "version": "0.13.0",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",
@@ -1,68 +0,0 @@
1
- /**
2
- * Copy of StandardSchemaV1 interface for compatibility
3
- */
4
- import { z } from "zod";
5
- export interface ToolParameters<Input = unknown, Output = Input> {
6
- readonly "~standard": ToolParameters.Props<Input, Output>;
7
- }
8
- export declare namespace ToolParameters {
9
- interface Props<Input = unknown, Output = Input> {
10
- readonly version: 1;
11
- readonly vendor: string;
12
- readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
13
- readonly types?: Types<Input, Output> | undefined;
14
- }
15
- type Result<Output> = SuccessResult<Output> | FailureResult;
16
- interface SuccessResult<Output> {
17
- readonly value: Output;
18
- readonly issues?: undefined;
19
- }
20
- interface FailureResult {
21
- readonly issues: ReadonlyArray<Issue>;
22
- }
23
- interface Issue {
24
- readonly message: string;
25
- readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
26
- }
27
- interface PathSegment {
28
- readonly key: PropertyKey;
29
- }
30
- interface Types<Input = unknown, Output = Input> {
31
- readonly input: Input;
32
- readonly output: Output;
33
- }
34
- type InferInput<Schema extends ToolParameters> = NonNullable<Schema["~standard"]["types"]>["input"];
35
- type InferOutput<Schema extends ToolParameters> = NonNullable<Schema["~standard"]["types"]>["output"];
36
- }
37
- /**
38
- * Tool interface for AI SDK compatibility
39
- */
40
- export interface AITool<T extends Record<string, unknown> | undefined = any, TParams extends ToolParameters = z.ZodSchema> {
41
- annotations?: {
42
- streamingHint?: boolean;
43
- } & {
44
- destructiveHint?: boolean;
45
- idempotentHint?: boolean;
46
- openWorldHint?: boolean;
47
- readOnlyHint?: boolean;
48
- title?: string;
49
- };
50
- canAccess?: (auth: T) => boolean;
51
- description?: string;
52
- execute: (args: ToolParameters.InferOutput<TParams>, context?: any) => Promise<any>;
53
- name?: string;
54
- inputSchema?: TParams;
55
- timeoutMs?: number;
56
- }
57
- export interface FastMCPTool<T extends Record<string, unknown> | undefined = any, TParams extends ToolParameters = ToolParameters> extends AITool<T, TParams> {
58
- parameters?: TParams;
59
- name: string;
60
- }
61
- /**
62
- * Type for a collection of AI tools with preserved schema types
63
- * @template T - Record mapping tool names to their inputSchema types
64
- * @example AITools<{getUserById: z.object({id: z.string()}), createUser: z.object({name: z.string()})}>
65
- */
66
- export type AITools<T extends Record<string, ToolParameters> = Record<string, z.ZodSchema>> = {
67
- [K in keyof T]: AITool<any, T[K]>;
68
- };
@@ -1,28 +0,0 @@
1
- import type { AITools, FastMCPTool, ToolParameters } from "./schemas/schemas_tool_config";
2
- /**
3
- * FastMCP-compatible interface for MCP server functionality
4
- * Provides exact API compatibility with FastMCP.addTool method
5
- */
6
- export interface FastMCPCompatible {
7
- addTool<Params extends ToolParameters>(tool: FastMCPTool<any, Params>): void;
8
- }
9
- /**
10
- * ModalityFastMCP - A FastMCP-compatible implementation
11
- * Provides addTool and getTools functionality for managing MCP tools
12
- */
13
- export declare class ModalityFastMCP implements FastMCPCompatible {
14
- private tools;
15
- /**
16
- * Add a tool to the server
17
- */
18
- addTool<Params extends ToolParameters>(tool: FastMCPTool<any, Params>): void;
19
- /**
20
- * Get all registered tools
21
- */
22
- getTools(): FastMCPTool<any, any>[];
23
- }
24
- /**
25
- * Setup function that optionally registers AITools with MCP server
26
- * Automatically infers and preserves schema types from the input
27
- */
28
- export declare const setupAITools: <T extends Record<string, ToolParameters>>(aiTools: AITools<T>, mcpServer?: FastMCPCompatible) => AITools<T>;