strapi-content-embeddings 0.2.0 → 0.2.1

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.
Files changed (39) hide show
  1. package/dist/_chunks/en-B4KWt_jN.js +0 -1
  2. package/dist/_chunks/en-Byx4XI2L.mjs +0 -1
  3. package/dist/admin/index.js +686 -4
  4. package/dist/admin/index.mjs +683 -4
  5. package/dist/server/index.js +293 -287
  6. package/dist/server/index.mjs +293 -287
  7. package/dist/server/src/index.d.ts +5 -0
  8. package/dist/server/src/mcp/schemas/index.d.ts +3 -0
  9. package/dist/server/src/mcp/tools/create-embedding.d.ts +3 -4
  10. package/dist/server/src/mcp/tools/get-embedding.d.ts +3 -3
  11. package/dist/server/src/mcp/tools/index.d.ts +1 -0
  12. package/dist/server/src/mcp/tools/list-embeddings.d.ts +3 -3
  13. package/dist/server/src/mcp/tools/rag-query.d.ts +3 -3
  14. package/dist/server/src/mcp/tools/semantic-search.d.ts +3 -3
  15. package/dist/server/src/services/ai-tools.d.ts +13 -0
  16. package/dist/server/src/services/embeddings.d.ts +2 -2
  17. package/dist/server/src/services/index.d.ts +5 -0
  18. package/dist/server/src/tools/create-embedding.d.ts +9 -0
  19. package/dist/server/src/tools/get-embedding.d.ts +8 -0
  20. package/dist/server/src/tools/index.d.ts +14 -0
  21. package/dist/server/src/tools/list-embeddings.d.ts +8 -0
  22. package/dist/server/src/tools/rag-query.d.ts +8 -0
  23. package/dist/server/src/tools/semantic-search.d.ts +8 -0
  24. package/dist/server/src/tools/types.d.ts +14 -0
  25. package/package.json +1 -1
  26. package/dist/_chunks/App-ByRBbkZn.js +0 -1600
  27. package/dist/_chunks/App-ByRBbkZn.js.map +0 -1
  28. package/dist/_chunks/App-MjsTrWRS.mjs +0 -1596
  29. package/dist/_chunks/App-MjsTrWRS.mjs.map +0 -1
  30. package/dist/_chunks/en-B4KWt_jN.js.map +0 -1
  31. package/dist/_chunks/en-Byx4XI2L.mjs.map +0 -1
  32. package/dist/_chunks/index-TWbcT-zJ.js +0 -785
  33. package/dist/_chunks/index-TWbcT-zJ.js.map +0 -1
  34. package/dist/_chunks/index-ifqYByO5.mjs +0 -783
  35. package/dist/_chunks/index-ifqYByO5.mjs.map +0 -1
  36. package/dist/admin/index.js.map +0 -1
  37. package/dist/admin/index.mjs.map +0 -1
  38. package/dist/server/index.js.map +0 -1
  39. package/dist/server/index.mjs.map +0 -1
@@ -133,6 +133,11 @@ declare const _default: {
133
133
  }>;
134
134
  recreateAllEmbeddings(): Promise<import("./services/sync").RecreateResult>;
135
135
  };
136
+ 'ai-tools': ({ strapi }: {
137
+ strapi: import("@strapi/types/dist/core").Strapi;
138
+ }) => {
139
+ getTools(): import("./tools").ToolDefinition[];
140
+ };
136
141
  };
137
142
  contentTypes: {
138
143
  embedding: {
@@ -49,14 +49,17 @@ export declare const CreateEmbeddingSchema: z.ZodObject<{
49
49
  title: z.ZodString;
50
50
  content: z.ZodString;
51
51
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
52
+ autoChunk: z.ZodOptional<z.ZodBoolean>;
52
53
  }, "strip", z.ZodTypeAny, {
53
54
  metadata?: Record<string, any>;
54
55
  content?: string;
55
56
  title?: string;
57
+ autoChunk?: boolean;
56
58
  }, {
57
59
  metadata?: Record<string, any>;
58
60
  content?: string;
59
61
  title?: string;
62
+ autoChunk?: boolean;
60
63
  }>;
61
64
  export declare const ToolSchemas: Record<string, z.ZodSchema>;
62
65
  /**
@@ -1,11 +1,10 @@
1
1
  /**
2
- * Create Embedding Tool
2
+ * Create Embedding Tool — MCP Wrapper
3
3
  *
4
- * Creates a new embedding from text content.
5
- * Supports automatic chunking for large content.
4
+ * Thin MCP adapter that delegates to the canonical tool implementation.
6
5
  */
7
6
  import type { Core } from '@strapi/strapi';
8
- export declare const createEmbeddingTool: {
7
+ export declare const createEmbeddingMcpTool: {
9
8
  name: string;
10
9
  description: string;
11
10
  inputSchema: {
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Get Embedding Tool
2
+ * Get Embedding Tool — MCP Wrapper
3
3
  *
4
- * Retrieves a single embedding by ID.
4
+ * Thin MCP adapter that delegates to the canonical tool implementation.
5
5
  */
6
6
  import type { Core } from '@strapi/strapi';
7
- export declare const getEmbeddingTool: {
7
+ export declare const getEmbeddingMcpTool: {
8
8
  name: string;
9
9
  description: string;
10
10
  inputSchema: {
@@ -2,6 +2,7 @@
2
2
  * MCP Tools for Content Embeddings
3
3
  *
4
4
  * Exposes vector search, RAG queries, and embedding management tools.
5
+ * Each handler is a thin wrapper around canonical tool definitions in ../../tools.
5
6
  */
6
7
  import type { Core } from '@strapi/strapi';
7
8
  export declare const tools: ({
@@ -1,10 +1,10 @@
1
1
  /**
2
- * List Embeddings Tool
2
+ * List Embeddings Tool — MCP Wrapper
3
3
  *
4
- * Lists all embeddings stored in the database.
4
+ * Thin MCP adapter that delegates to the canonical tool implementation.
5
5
  */
6
6
  import type { Core } from '@strapi/strapi';
7
- export declare const listEmbeddingsTool: {
7
+ export declare const listEmbeddingsMcpTool: {
8
8
  name: string;
9
9
  description: string;
10
10
  inputSchema: {
@@ -1,10 +1,10 @@
1
1
  /**
2
- * RAG Query Tool
2
+ * RAG Query Tool — MCP Wrapper
3
3
  *
4
- * Performs Retrieval-Augmented Generation to answer questions using embedded content.
4
+ * Thin MCP adapter that delegates to the canonical tool implementation.
5
5
  */
6
6
  import type { Core } from '@strapi/strapi';
7
- export declare const ragQueryTool: {
7
+ export declare const ragQueryMcpTool: {
8
8
  name: string;
9
9
  description: string;
10
10
  inputSchema: {
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Semantic Search Tool
2
+ * Semantic Search Tool — MCP Wrapper
3
3
  *
4
- * Performs vector similarity search to find relevant content.
4
+ * Thin MCP adapter that delegates to the canonical tool implementation.
5
5
  */
6
6
  import type { Core } from '@strapi/strapi';
7
- export declare const semanticSearchTool: {
7
+ export declare const semanticSearchMcpTool: {
8
8
  name: string;
9
9
  description: string;
10
10
  inputSchema: {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * AI Tools Service — Adapter for AI SDK Discovery
3
+ *
4
+ * Re-exports canonical tool definitions from ../tools for AI SDK registration.
5
+ * The AI SDK discovery loop calls getTools() to register these into its ToolRegistry.
6
+ */
7
+ import type { Core } from '@strapi/strapi';
8
+ declare const _default: ({ strapi }: {
9
+ strapi: Core.Strapi;
10
+ }) => {
11
+ getTools(): import("../tools").ToolDefinition[];
12
+ };
13
+ export default _default;
@@ -64,8 +64,8 @@ declare const embeddings: ({ strapi }: {
64
64
  */
65
65
  deleteRelatedChunks(documentId: string): Promise<number>;
66
66
  /**
67
- * Update a single chunk's content and embedding
68
- * Updates only the specified chunk without affecting other chunks in the group
67
+ * Update embeddings with automatic chunking support
68
+ * Handles re-chunking when content changes and exceeds chunk size
69
69
  */
70
70
  updateChunkedEmbedding(id: string, data: UpdateEmbeddingData): Promise<ChunkedEmbeddingResult>;
71
71
  updateEmbedding(id: string, data: UpdateEmbeddingData): Promise<any>;
@@ -44,5 +44,10 @@ declare const _default: {
44
44
  }>;
45
45
  recreateAllEmbeddings(): Promise<import("./sync").RecreateResult>;
46
46
  };
47
+ 'ai-tools': ({ strapi }: {
48
+ strapi: import("@strapi/types/dist/core").Strapi;
49
+ }) => {
50
+ getTools(): import("../tools").ToolDefinition[];
51
+ };
47
52
  };
48
53
  export default _default;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Create Embedding — Canonical Tool Definition
3
+ *
4
+ * Creates a new embedding from text content.
5
+ * Supports automatic chunking for large content.
6
+ * Returns raw result objects (no MCP envelope).
7
+ */
8
+ import type { ToolDefinition } from './types';
9
+ export declare const createEmbeddingTool: ToolDefinition;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get Embedding — Canonical Tool Definition
3
+ *
4
+ * Retrieves a single embedding by document ID.
5
+ * Returns raw result objects (no MCP envelope).
6
+ */
7
+ import type { ToolDefinition } from './types';
8
+ export declare const getEmbeddingTool: ToolDefinition;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Canonical Tool Definitions for Content Embeddings
3
+ *
4
+ * These are the source-of-truth implementations.
5
+ * Both the AI SDK service (ai-tools.ts) and the MCP server consume these.
6
+ */
7
+ export type { ToolDefinition } from './types';
8
+ export { semanticSearchTool } from './semantic-search';
9
+ export { ragQueryTool } from './rag-query';
10
+ export { listEmbeddingsTool } from './list-embeddings';
11
+ export { getEmbeddingTool } from './get-embedding';
12
+ export { createEmbeddingTool } from './create-embedding';
13
+ import type { ToolDefinition } from './types';
14
+ export declare const tools: ToolDefinition[];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * List Embeddings — Canonical Tool Definition
3
+ *
4
+ * Lists all embeddings stored in the database with pagination.
5
+ * Returns raw result objects (no MCP envelope).
6
+ */
7
+ import type { ToolDefinition } from './types';
8
+ export declare const listEmbeddingsTool: ToolDefinition;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * RAG Query — Canonical Tool Definition
3
+ *
4
+ * Performs Retrieval-Augmented Generation to answer questions using embedded content.
5
+ * Returns raw result objects (no MCP envelope).
6
+ */
7
+ import type { ToolDefinition } from './types';
8
+ export declare const ragQueryTool: ToolDefinition;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Semantic Search — Canonical Tool Definition
3
+ *
4
+ * Performs vector similarity search to find relevant content.
5
+ * Returns raw result objects (no MCP envelope).
6
+ */
7
+ import type { ToolDefinition } from './types';
8
+ export declare const semanticSearchTool: ToolDefinition;
@@ -0,0 +1,14 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ import type { z } from 'zod';
3
+ export interface ToolDefinition {
4
+ name: string;
5
+ description: string;
6
+ schema: z.ZodObject<any>;
7
+ execute: (args: any, strapi: Core.Strapi, context?: {
8
+ adminUserId?: number;
9
+ }) => Promise<unknown>;
10
+ /** If true, tool is only available in AI SDK chat, not exposed via MCP */
11
+ internal?: boolean;
12
+ /** If true, tool is safe for unauthenticated public chat (read-only) */
13
+ publicSafe?: boolean;
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-content-embeddings",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Strapi v5 plugin for vector embeddings with OpenAI and Neon PostgreSQL. Enables semantic search, RAG chat, and MCP (Model Context Protocol) integration.",
5
5
  "keywords": [
6
6
  "strapi",