@qikdev/mcp 6.6.3 → 6.6.5

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Qik Platform MCP Server - Enhanced Version
3
+ * Qik Platform MCP Server - Enhanced Version with Comprehensive Documentation
4
4
  *
5
5
  * This MCP server provides comprehensive integration with the Qik platform,
6
6
  * enabling AI assistants to interact with Qik's content management system,
@@ -13,12 +13,42 @@
13
13
  * - Dynamic tool schema generation
14
14
  * - Comprehensive API coverage
15
15
  * - Intelligent request building and field validation
16
+ * - Advanced disambiguation logic for definitions vs instances
17
+ * - Workflow system documentation and automation
18
+ * - Comprehensive scope and permission management
19
+ *
20
+ * IMPORTANT QIK CONCEPTS:
21
+ *
22
+ * 1. DEFINITIONS vs INSTANCES:
23
+ * - Definitions: Templates that define structure (e.g., "workflow definition", "content type definition")
24
+ * - Instances: Actual content items created from definitions (e.g., "workflow card", "article instance")
25
+ * - When user says "create a workflow" they usually mean create a workflow DEFINITION
26
+ * - When user says "add Jim to workflow X" they mean create a workflow CARD instance
27
+ *
28
+ * 2. WORKFLOW SYSTEM:
29
+ * - Workflow Definitions: Define the structure with columns, steps, automation
30
+ * - Workflow Cards: Individual items that move through the workflow
31
+ * - Columns: Represent stages in the workflow (e.g., "To Do", "In Progress", "Done")
32
+ * - Steps: Specific positions within columns where cards can be placed
33
+ * - Automation: Entry/exit/success/fail functions that run when cards move
34
+ *
35
+ * 3. SCOPE SYSTEM:
36
+ * - Hierarchical permission structure (like folders)
37
+ * - Every content item must belong to at least one scope
38
+ * - Users need appropriate permissions within scopes to perform actions
39
+ * - Scopes can inherit permissions from parent scopes
40
+ *
41
+ * 4. CONTENT TYPE SYSTEM:
42
+ * - Base types: Core Qik types (article, profile, event, etc.)
43
+ * - Extended types: Custom types that extend base types with additional fields
44
+ * - Fields vs DefinedFields: Fields go at root level, definedFields go in data object
16
45
  */
17
46
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
18
47
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
19
48
  import { CallToolRequestSchema, ListToolsRequestSchema, ErrorCode, McpError, } from "@modelcontextprotocol/sdk/types.js";
20
49
  import axios from 'axios';
21
50
  import FormData from 'form-data';
51
+ import { ConfigManager } from './config.js';
22
52
  // Environment variables
23
53
  const QIK_API_URL = process.env.QIK_API_URL || 'https://api.qik.dev';
24
54
  const QIK_ACCESS_TOKEN = process.env.QIK_ACCESS_TOKEN;
@@ -29,6 +59,7 @@ export class QikMCPServer {
29
59
  userSession = null;
30
60
  lastGlossaryUpdate = 0;
31
61
  GLOSSARY_CACHE_TTL = 5 * 60 * 1000; // 5 minutes
62
+ serverName = 'Qik'; // Default fallback
32
63
  constructor() {
33
64
  if (!QIK_ACCESS_TOKEN) {
34
65
  throw new Error('QIK_ACCESS_TOKEN environment variable is required. Run "qik-mcp-server setup" to configure.');
@@ -68,7 +99,9 @@ export class QikMCPServer {
68
99
  }
69
100
  async initializeServer() {
70
101
  try {
71
- // Load user session first
102
+ // Load server name from config first
103
+ await this.loadServerName();
104
+ // Load user session
72
105
  await this.loadUserSession();
73
106
  // Then load glossary
74
107
  await this.loadGlossary();
@@ -78,6 +111,23 @@ export class QikMCPServer {
78
111
  this.log(`Failed to initialize server: ${this.formatError(error)}`);
79
112
  }
80
113
  }
114
+ async loadServerName() {
115
+ try {
116
+ const configManager = new ConfigManager();
117
+ const config = await configManager.loadConfig();
118
+ if (config && config.serverName) {
119
+ this.serverName = config.serverName;
120
+ this.log(`Loaded server name: ${this.serverName}`);
121
+ }
122
+ else {
123
+ this.log(`No server name found in config, using default: ${this.serverName}`);
124
+ }
125
+ }
126
+ catch (error) {
127
+ this.log(`Failed to load server name from config: ${this.formatError(error)}`);
128
+ // Keep default fallback value
129
+ }
130
+ }
81
131
  async loadUserSession() {
82
132
  try {
83
133
  const response = await this.axiosInstance.get('/user');
@@ -710,161 +760,541 @@ EXAMPLES:
710
760
  }
711
761
  };
712
762
  }
763
+ /**
764
+ * Enhanced intelligent content creation with advanced disambiguation logic
765
+ *
766
+ * This method provides sophisticated analysis of user intent to distinguish between:
767
+ * - Creating workflow DEFINITIONS vs workflow CARD instances
768
+ * - Creating content type DEFINITIONS vs content INSTANCES
769
+ * - Understanding context clues like "add person to workflow" vs "create new workflow"
770
+ */
713
771
  async intelligentContentCreation(description, additionalData) {
714
- // First, try to find content types that match
772
+ // STEP 1: Advanced Intent Analysis with Disambiguation Logic
773
+ const intentAnalysis = this.analyzeUserIntent(description, additionalData);
774
+ // Handle workflow-specific disambiguation
775
+ if (intentAnalysis.isWorkflowRelated) {
776
+ return await this.handleWorkflowDisambiguation(description, additionalData, intentAnalysis);
777
+ }
778
+ // STEP 2: Standard content type matching
715
779
  const contentTypeMatches = this.findContentTypesByDescription(description);
716
780
  if (contentTypeMatches.length === 0) {
717
- // If we can't find any matches, provide helpful suggestions
718
- const availableTypes = Object.entries(this.glossary).map(([key, type]) => {
719
- let title = 'Unknown';
720
- let plural = 'Unknown';
721
- if (type && typeof type === 'object') {
722
- if (type.definition) {
723
- title = type.definition.title || title;
724
- plural = type.definition.plural || plural;
725
- }
726
- else if (type.type) {
727
- title = type.type.title || title;
728
- plural = type.type.plural || plural;
729
- }
730
- else if (type.title) {
731
- title = type.title || title;
732
- plural = type.plural || plural;
733
- }
734
- }
735
- return { key, title, plural };
736
- });
781
+ return await this.handleNoContentTypeMatches(description);
782
+ }
783
+ if (contentTypeMatches.length > 1) {
784
+ return await this.handleMultipleContentTypeMatches(description, contentTypeMatches);
785
+ }
786
+ // STEP 3: Single match found - provide comprehensive guidance
787
+ const contentType = contentTypeMatches[0];
788
+ return await this.handleSingleContentTypeMatch(contentType, description, additionalData);
789
+ }
790
+ /**
791
+ * Analyzes user intent to distinguish between different types of content creation
792
+ */
793
+ analyzeUserIntent(description, additionalData) {
794
+ const normalizedDesc = description.toLowerCase().trim();
795
+ const contextClues = [];
796
+ // Workflow-related keywords
797
+ const workflowKeywords = ['workflow', 'kanban', 'board', 'column', 'step', 'process', 'pipeline'];
798
+ const isWorkflowRelated = workflowKeywords.some(keyword => normalizedDesc.includes(keyword));
799
+ // Definition creation indicators
800
+ const definitionIndicators = [
801
+ 'create a new', 'create new', 'make a new', 'design a', 'set up a', 'build a',
802
+ 'define a', 'establish a', 'configure a'
803
+ ];
804
+ const isDefinitionCreation = definitionIndicators.some(indicator => normalizedDesc.includes(indicator));
805
+ // Instance creation indicators
806
+ const instanceIndicators = [
807
+ 'add', 'assign', 'put', 'move', 'place', 'insert', 'include'
808
+ ];
809
+ const isInstanceCreation = instanceIndicators.some(indicator => normalizedDesc.includes(indicator));
810
+ // Person assignment indicators
811
+ const personIndicators = [
812
+ 'add person', 'assign person', 'add user', 'assign user', 'add someone', 'assign someone',
813
+ 'add jim', 'add john', 'add sarah', 'put person', 'move person'
814
+ ];
815
+ const isPersonAssignment = personIndicators.some(indicator => normalizedDesc.includes(indicator));
816
+ // Collect context clues
817
+ if (isWorkflowRelated)
818
+ contextClues.push('workflow-related');
819
+ if (isDefinitionCreation)
820
+ contextClues.push('definition-creation');
821
+ if (isInstanceCreation)
822
+ contextClues.push('instance-creation');
823
+ if (isPersonAssignment)
824
+ contextClues.push('person-assignment');
825
+ // Calculate confidence based on clarity of intent
826
+ let confidence = 0.5; // Base confidence
827
+ if (isDefinitionCreation && !isInstanceCreation)
828
+ confidence = 0.9;
829
+ if (isInstanceCreation && !isDefinitionCreation)
830
+ confidence = 0.9;
831
+ if (isPersonAssignment)
832
+ confidence = 0.95;
833
+ return {
834
+ isWorkflowRelated,
835
+ isDefinitionCreation,
836
+ isInstanceCreation,
837
+ isPersonAssignment,
838
+ confidence,
839
+ contextClues
840
+ };
841
+ }
842
+ /**
843
+ * Handles workflow-specific disambiguation with comprehensive guidance
844
+ */
845
+ async handleWorkflowDisambiguation(description, additionalData, intentAnalysis) {
846
+ const normalizedDesc = description.toLowerCase().trim();
847
+ // Check if user wants to create a workflow DEFINITION
848
+ if (intentAnalysis.isDefinitionCreation ||
849
+ normalizedDesc.includes('create a workflow') ||
850
+ normalizedDesc.includes('new workflow') ||
851
+ normalizedDesc.includes('design workflow')) {
737
852
  return {
738
853
  content: [{
739
854
  type: 'text',
740
- text: `I couldn't find a content type for "${description}". Here are the available content types:\n\n${availableTypes.map(t => `- ${t.key}: ${t.title} (${t.plural})`).join('\n')}\n\nPlease specify which content type you'd like to create, or I can help you create content using one of these types.`,
855
+ text: `🔧 **WORKFLOW DEFINITION CREATION**
856
+
857
+ You want to create a new workflow definition (template). This defines the structure, columns, steps, and automation rules.
858
+
859
+ **WORKFLOW DEFINITION STRUCTURE:**
860
+
861
+ A workflow definition includes:
862
+ - **Columns**: Stages like "To Do", "In Progress", "Review", "Done"
863
+ - **Steps**: Specific positions within columns where cards can be placed
864
+ - **Automation**: Functions that run when cards enter/exit steps
865
+ - **Due Date Behavior**: How due dates are calculated and managed
866
+ - **Completion Criteria**: Rules that determine when workflow is complete
867
+
868
+ **EXAMPLE WORKFLOW DEFINITION:**
869
+ \`\`\`json
870
+ {
871
+ "type": "definition",
872
+ "title": "New Student Induction Workflow",
873
+ "definesType": "workflowcard",
874
+ "workflow": [
875
+ {
876
+ "title": "Enrollment",
877
+ "description": "Initial enrollment and documentation",
878
+ "steps": [
879
+ {
880
+ "title": "Application Received",
881
+ "type": "step",
882
+ "description": "Student application has been received",
883
+ "duration": 1440,
884
+ "assignees": [],
885
+ "entryFunction": "// Code to run when card enters this step",
886
+ "exitFunction": "// Code to run when card exits this step"
887
+ }
888
+ ]
889
+ },
890
+ {
891
+ "title": "Processing",
892
+ "description": "Review and approval process",
893
+ "steps": [
894
+ {
895
+ "title": "Document Review",
896
+ "type": "step",
897
+ "description": "Review all submitted documents"
898
+ }
899
+ ]
900
+ }
901
+ ]
902
+ }
903
+ \`\`\`
904
+
905
+ To create this workflow definition, use:
906
+ \`qik_create_content\` with type: "definition" and the workflow structure in the data field.
907
+
908
+ Would you like me to help you create a specific workflow definition?`,
741
909
  }],
742
- isError: true,
743
910
  };
744
911
  }
745
- if (contentTypeMatches.length > 1) {
746
- // Multiple matches found - ask for clarification
747
- const matchDetails = contentTypeMatches.map(key => {
748
- const type = this.glossary[key];
749
- let title = 'Unknown';
750
- let plural = 'Unknown';
751
- if (type && typeof type === 'object') {
752
- if (type.definition) {
753
- title = type.definition.title || title;
754
- plural = type.definition.plural || plural;
755
- }
756
- else if (type.type) {
757
- title = type.type.title || title;
758
- plural = type.type.plural || plural;
759
- }
760
- else if (type.title) {
761
- title = type.title || title;
762
- plural = type.plural || plural;
763
- }
764
- }
765
- return { key, title, plural };
766
- });
912
+ // Check if user wants to add someone to an existing workflow (create workflow CARD)
913
+ if (intentAnalysis.isPersonAssignment ||
914
+ normalizedDesc.includes('add') && normalizedDesc.includes('to workflow') ||
915
+ normalizedDesc.includes('assign') && normalizedDesc.includes('workflow')) {
767
916
  return {
768
917
  content: [{
769
918
  type: 'text',
770
- text: `I found multiple content types that match "${description}". Please clarify which one you'd like to create:\n\n${matchDetails.map(t => `- ${t.key}: ${t.title} (${t.plural})`).join('\n')}\n\nPlease specify the exact content type key you'd like to use.`,
919
+ text: `👤 **WORKFLOW CARD CREATION (Person Assignment)**
920
+
921
+ You want to add a person to an existing workflow by creating a workflow card instance.
922
+
923
+ **WORKFLOW CARD vs WORKFLOW DEFINITION:**
924
+ - **Workflow Definition**: The template/structure (columns, steps, rules)
925
+ - **Workflow Card**: Individual items that move through the workflow
926
+
927
+ **TO ADD SOMEONE TO A WORKFLOW:**
928
+
929
+ 1. **Find the workflow definition ID** first using:
930
+ \`qik_list_content\` with type: "definition" and search for your workflow name
931
+
932
+ 2. **Create a workflow card** using:
933
+ \`qik_create_content\` with type: "workflowcard"
934
+
935
+ **EXAMPLE WORKFLOW CARD:**
936
+ \`\`\`json
937
+ {
938
+ "type": "workflowcard",
939
+ "title": "John Smith - Student Induction",
940
+ "reference": "PROFILE_ID_HERE",
941
+ "referenceType": "profile",
942
+ "data": {
943
+ "workflowDefinition": "WORKFLOW_DEFINITION_ID_HERE",
944
+ "currentStep": "application-received",
945
+ "assignedTo": ["USER_ID_HERE"],
946
+ "dueDate": "2024-01-15T09:00:00.000Z"
947
+ }
948
+ }
949
+ \`\`\`
950
+
951
+ **NEED MORE HELP?**
952
+ - What's the name of the workflow you want to add someone to?
953
+ - Who do you want to add to the workflow?
954
+ - Do you have the workflow definition ID?`,
771
955
  }],
772
- isError: true,
773
956
  };
774
957
  }
775
- // Single match found
776
- const contentType = contentTypeMatches[0];
958
+ // General workflow guidance
959
+ return {
960
+ content: [{
961
+ type: 'text',
962
+ text: `🔄 **WORKFLOW SYSTEM GUIDANCE**
963
+
964
+ I detected you're working with workflows. Please clarify your intent:
965
+
966
+ **OPTION 1: Create Workflow Definition (Template)**
967
+ - "Create a new workflow"
968
+ - "Design a student onboarding workflow"
969
+ - "Set up a project management workflow"
970
+ → Creates the structure, columns, steps, and rules
971
+
972
+ **OPTION 2: Add Person to Existing Workflow**
973
+ - "Add Jim to the student workflow"
974
+ - "Assign Sarah to project workflow"
975
+ - "Put John in the onboarding process"
976
+ → Creates a workflow card instance for a person
977
+
978
+ **WORKFLOW CONCEPTS:**
979
+ - **Definition**: The template (like a Kanban board layout)
980
+ - **Card**: Individual items moving through the workflow
981
+ - **Columns**: Stages (To Do, In Progress, Done)
982
+ - **Steps**: Specific positions within columns
983
+ - **Automation**: Code that runs when cards move
984
+
985
+ **AVAILABLE WORKFLOW CONTENT TYPES:**
986
+ - \`definition\`: For creating workflow templates
987
+ - \`workflowcard\`: For individual workflow instances
988
+ - \`object\`: For custom workflow-related objects
989
+
990
+ Please specify: Are you creating a new workflow template, or adding someone to an existing workflow?`,
991
+ }],
992
+ };
993
+ }
994
+ /**
995
+ * Handles cases where no content types match the description
996
+ */
997
+ async handleNoContentTypeMatches(description) {
998
+ const availableTypes = Object.entries(this.glossary).map(([key, type]) => {
999
+ let title = 'Unknown';
1000
+ let plural = 'Unknown';
1001
+ if (type && typeof type === 'object') {
1002
+ if (type.definition) {
1003
+ title = type.definition.title || title;
1004
+ plural = type.definition.plural || plural;
1005
+ }
1006
+ else if (type.type) {
1007
+ title = type.type.title || title;
1008
+ plural = type.type.plural || plural;
1009
+ }
1010
+ else if (type.title) {
1011
+ title = type.title || title;
1012
+ plural = type.plural || plural;
1013
+ }
1014
+ }
1015
+ return { key, title, plural };
1016
+ });
1017
+ // Group types by category for better organization
1018
+ const categorizedTypes = this.categorizeContentTypes(availableTypes);
1019
+ return {
1020
+ content: [{
1021
+ type: 'text',
1022
+ text: `❌ **NO MATCHING CONTENT TYPE FOUND**
1023
+
1024
+ I couldn't find a content type for "${description}".
1025
+
1026
+ **AVAILABLE CONTENT TYPES BY CATEGORY:**
1027
+
1028
+ ${categorizedTypes}
1029
+
1030
+ **SUGGESTIONS:**
1031
+ - Try using more specific terms (e.g., "incident report" instead of "report")
1032
+ - Check if you meant to create a workflow definition or workflow card
1033
+ - Use the exact content type key from the list above
1034
+
1035
+ **NEED HELP?**
1036
+ - Use \`qik_get_glossary\` to see all available types with descriptions
1037
+ - Use \`qik_get_content_definition\` with a specific type to see its fields`,
1038
+ }],
1039
+ isError: true,
1040
+ };
1041
+ }
1042
+ /**
1043
+ * Categorizes content types for better organization in help text
1044
+ */
1045
+ categorizeContentTypes(types) {
1046
+ const categories = {
1047
+ 'Core Content': [],
1048
+ 'People & Profiles': [],
1049
+ 'Workflows & Processes': [],
1050
+ 'Communication': [],
1051
+ 'Media & Files': [],
1052
+ 'System & Admin': [],
1053
+ 'Other': []
1054
+ };
1055
+ for (const type of types) {
1056
+ const key = type.key.toLowerCase();
1057
+ const title = type.title.toLowerCase();
1058
+ if (key.includes('profile') || key.includes('person') || key.includes('user')) {
1059
+ categories['People & Profiles'].push(type);
1060
+ }
1061
+ else if (key.includes('workflow') || key.includes('definition') || key.includes('process')) {
1062
+ categories['Workflows & Processes'].push(type);
1063
+ }
1064
+ else if (key.includes('comment') || key.includes('message') || key.includes('notification') || key.includes('email')) {
1065
+ categories['Communication'].push(type);
1066
+ }
1067
+ else if (key.includes('file') || key.includes('image') || key.includes('video') || key.includes('audio')) {
1068
+ categories['Media & Files'].push(type);
1069
+ }
1070
+ else if (key.includes('scope') || key.includes('role') || key.includes('policy') || key.includes('variable')) {
1071
+ categories['System & Admin'].push(type);
1072
+ }
1073
+ else if (['article', 'event', 'object'].includes(key)) {
1074
+ categories['Core Content'].push(type);
1075
+ }
1076
+ else {
1077
+ categories['Other'].push(type);
1078
+ }
1079
+ }
1080
+ let result = '';
1081
+ for (const [category, categoryTypes] of Object.entries(categories)) {
1082
+ if (categoryTypes.length > 0) {
1083
+ result += `\n**${category}:**\n`;
1084
+ result += categoryTypes.map(t => `- ${t.key}: ${t.title} (${t.plural})`).join('\n');
1085
+ result += '\n';
1086
+ }
1087
+ }
1088
+ return result;
1089
+ }
1090
+ /**
1091
+ * Handles cases where multiple content types match
1092
+ */
1093
+ async handleMultipleContentTypeMatches(description, contentTypeMatches) {
1094
+ const matchDetails = contentTypeMatches.map(key => {
1095
+ const type = this.glossary[key];
1096
+ let title = 'Unknown';
1097
+ let plural = 'Unknown';
1098
+ let baseType = '';
1099
+ if (type && typeof type === 'object') {
1100
+ if (type.definition) {
1101
+ title = type.definition.title || title;
1102
+ plural = type.definition.plural || plural;
1103
+ baseType = type.definition.definesType || '';
1104
+ }
1105
+ else if (type.type) {
1106
+ title = type.type.title || title;
1107
+ plural = type.type.plural || plural;
1108
+ }
1109
+ else if (type.title) {
1110
+ title = type.title || title;
1111
+ plural = type.plural || plural;
1112
+ baseType = type.definesType || '';
1113
+ }
1114
+ }
1115
+ return { key, title, plural, baseType };
1116
+ });
1117
+ return {
1118
+ content: [{
1119
+ type: 'text',
1120
+ text: `🔍 **MULTIPLE CONTENT TYPES FOUND**
1121
+
1122
+ I found multiple content types that match "${description}". Please clarify which one you'd like to create:
1123
+
1124
+ ${matchDetails.map(t => {
1125
+ let description = `- **${t.key}**: ${t.title} (${t.plural})`;
1126
+ if (t.baseType) {
1127
+ description += ` - extends ${t.baseType}`;
1128
+ }
1129
+ return description;
1130
+ }).join('\n')}
1131
+
1132
+ **TO PROCEED:**
1133
+ 1. Choose the exact content type key from above
1134
+ 2. Use \`qik_create_content\` with your chosen type
1135
+ 3. Or use \`qik_get_content_definition\` to see field details first
1136
+
1137
+ **NEED MORE INFO?**
1138
+ Use \`qik_get_content_definition\` with any of the type keys above to see their specific fields and requirements.`,
1139
+ }],
1140
+ isError: true,
1141
+ };
1142
+ }
1143
+ /**
1144
+ * Handles single content type match with comprehensive guidance
1145
+ */
1146
+ async handleSingleContentTypeMatch(contentType, description, additionalData) {
777
1147
  const typeInfo = this.getContentTypeInfo(contentType);
778
1148
  if (!typeInfo) {
779
1149
  return {
780
1150
  content: [{
781
1151
  type: 'text',
782
- text: `Found content type "${contentType}" but couldn't load its definition.`,
1152
+ text: `❌ Found content type "${contentType}" but couldn't load its definition.`,
783
1153
  }],
784
1154
  isError: true,
785
1155
  };
786
1156
  }
787
- // Analyze the fields to provide guidance
1157
+ // Extract comprehensive type information
1158
+ const typeAnalysis = this.analyzeContentTypeStructure(typeInfo);
1159
+ let guidance = `✅ **CONTENT TYPE FOUND: ${contentType.toUpperCase()}**\n\n`;
1160
+ guidance += `**Type**: ${typeAnalysis.title}\n`;
1161
+ guidance += `**Description**: ${typeAnalysis.description || 'No description available'}\n`;
1162
+ if (typeAnalysis.baseType) {
1163
+ guidance += `**Extends**: ${typeAnalysis.baseType}\n`;
1164
+ }
1165
+ guidance += `\n**FIELD STRUCTURE:**\n`;
1166
+ if (typeAnalysis.requiredFields.length > 0) {
1167
+ guidance += `\n**Required Fields:**\n`;
1168
+ guidance += typeAnalysis.requiredFields.map(f => `- **${f.key}** (${f.title}): ${f.description || 'No description'}`).join('\n');
1169
+ }
1170
+ if (typeAnalysis.optionalFields.length > 0) {
1171
+ guidance += `\n\n**Optional Fields:**\n`;
1172
+ guidance += typeAnalysis.optionalFields.map(f => `- **${f.key}** (${f.title}): ${f.description || 'No description'}`).join('\n');
1173
+ }
1174
+ // Handle creation if data provided
1175
+ if (additionalData && typeof additionalData === 'object' && additionalData.title) {
1176
+ return await this.handleContentCreationWithData(contentType, additionalData, typeAnalysis);
1177
+ }
1178
+ // Provide creation guidance
1179
+ guidance += await this.generateCreationGuidance(contentType, typeAnalysis);
1180
+ return {
1181
+ content: [{
1182
+ type: 'text',
1183
+ text: guidance,
1184
+ }],
1185
+ };
1186
+ }
1187
+ /**
1188
+ * Analyzes content type structure for comprehensive information
1189
+ */
1190
+ analyzeContentTypeStructure(typeInfo) {
788
1191
  let fields = [];
789
- let typeTitle = 'Unknown';
1192
+ let title = 'Unknown';
1193
+ let description = '';
1194
+ let baseType = '';
790
1195
  if (typeInfo.definition) {
791
1196
  fields = typeInfo.definition.fields || [];
792
- typeTitle = typeInfo.definition.title || typeTitle;
1197
+ title = typeInfo.definition.title || title;
1198
+ description = typeInfo.definition.description || '';
1199
+ baseType = typeInfo.definition.definesType || '';
793
1200
  }
794
1201
  else if (typeInfo.type) {
795
1202
  fields = typeInfo.type.fields || [];
796
- typeTitle = typeInfo.type.title || typeTitle;
1203
+ title = typeInfo.type.title || title;
1204
+ description = typeInfo.type.description || '';
797
1205
  }
798
1206
  else if (typeInfo.fields) {
799
1207
  fields = typeInfo.fields || [];
800
- typeTitle = typeInfo.title || typeTitle;
1208
+ title = typeInfo.title || title;
1209
+ description = typeInfo.description || '';
1210
+ baseType = typeInfo.definesType || '';
801
1211
  }
802
1212
  const requiredFields = fields.filter((f) => f.minimum && f.minimum > 0);
803
1213
  const optionalFields = fields.filter((f) => !f.minimum || f.minimum === 0);
804
- let guidance = `I found the content type "${contentType}" (${typeTitle}) for "${description}".\n\n`;
805
- if (requiredFields.length > 0) {
806
- guidance += `Required fields:\n${requiredFields.map(f => `- ${f.key} (${f.title}): ${f.description || 'No description'}`).join('\n')}\n\n`;
807
- }
808
- if (optionalFields.length > 0) {
809
- guidance += `Optional fields:\n${optionalFields.map(f => `- ${f.key} (${f.title}): ${f.description || 'No description'}`).join('\n')}\n\n`;
810
- }
811
- // If additional data was provided, check if we have scopes and try to create the content
812
- if (additionalData && typeof additionalData === 'object' && additionalData.title) {
813
- // Check if scopes are provided
814
- if (!additionalData.meta || !additionalData.meta.scopes || !Array.isArray(additionalData.meta.scopes) || additionalData.meta.scopes.length === 0) {
815
- // Get available scopes
816
- const scopeTree = await this.getAvailableScopes();
817
- if (scopeTree) {
818
- const availableScopes = this.extractScopesWithPermissions(scopeTree, 'create');
819
- if (availableScopes.length === 0) {
820
- return {
821
- content: [{
822
- type: 'text',
823
- text: `You don't have permission to create content in any scopes. Please contact your administrator.`,
824
- }],
825
- isError: true,
826
- };
827
- }
1214
+ return {
1215
+ title,
1216
+ description,
1217
+ baseType,
1218
+ fields,
1219
+ requiredFields,
1220
+ optionalFields,
1221
+ fieldCount: fields.length
1222
+ };
1223
+ }
1224
+ /**
1225
+ * Handles content creation when data is provided
1226
+ */
1227
+ async handleContentCreationWithData(contentType, additionalData, typeAnalysis) {
1228
+ // Check if scopes are provided
1229
+ if (!additionalData.meta || !additionalData.meta.scopes || !Array.isArray(additionalData.meta.scopes) || additionalData.meta.scopes.length === 0) {
1230
+ const scopeTree = await this.getAvailableScopes();
1231
+ if (scopeTree) {
1232
+ const availableScopes = this.extractScopesWithPermissions(scopeTree, 'create');
1233
+ if (availableScopes.length === 0) {
828
1234
  return {
829
1235
  content: [{
830
1236
  type: 'text',
831
- text: `To create "${additionalData.title}" as a ${typeTitle}, you need to specify which scope to create it in. You have permission to create content in these scopes:\n\n${availableScopes.map(s => `- ${s.id}: ${s.path}`).join('\n')}\n\nPlease use the qik_create_content tool with:\n- type: "${contentType}"\n- title: "${additionalData.title}"\n- meta: { "scopes": ["scope_id_here"] }\n- data: { /* your field values */ }`,
1237
+ text: `🚫 **PERMISSION DENIED**\n\nYou don't have permission to create content in any scopes. Please contact your administrator.`,
832
1238
  }],
1239
+ isError: true,
833
1240
  };
834
1241
  }
1242
+ return {
1243
+ content: [{
1244
+ type: 'text',
1245
+ text: `📍 **SCOPE SELECTION REQUIRED**\n\nTo create "${additionalData.title}" as a ${typeAnalysis.title}, you need to specify which scope to create it in.\n\n**Available Scopes:**\n${availableScopes.map(s => `- **${s.id}**: ${s.path}`).join('\n')}\n\n**TO CREATE:**\nUse \`qik_create_content\` with:\n- type: "${contentType}"\n- title: "${additionalData.title}"\n- meta: { "scopes": ["scope_id_here"] }\n- data: { /* your field values */ }`,
1246
+ }],
1247
+ };
835
1248
  }
836
- // Scopes are provided, proceed with creation
837
- const title = additionalData.title || `New ${typeTitle}`;
838
- const data = additionalData.data || {};
839
- const meta = additionalData.meta || {};
840
- return await this.createContent({
841
- type: contentType,
842
- title,
843
- data,
844
- meta,
845
- });
846
1249
  }
847
- // Get available scopes for guidance
1250
+ // Proceed with creation
1251
+ const title = additionalData.title || `New ${typeAnalysis.title}`;
1252
+ const data = additionalData.data || {};
1253
+ const meta = additionalData.meta || {};
1254
+ return await this.createContent({
1255
+ type: contentType,
1256
+ title,
1257
+ data,
1258
+ meta,
1259
+ });
1260
+ }
1261
+ /**
1262
+ * Generates comprehensive creation guidance
1263
+ */
1264
+ async generateCreationGuidance(contentType, typeAnalysis) {
1265
+ let guidance = `\n\n**CREATION GUIDANCE:**\n`;
1266
+ // Get available scopes
848
1267
  const scopeTree = await this.getAvailableScopes();
849
1268
  let scopeGuidance = '';
850
1269
  if (scopeTree) {
851
1270
  const availableScopes = this.extractScopesWithPermissions(scopeTree, 'create');
852
1271
  if (availableScopes.length > 0) {
853
- scopeGuidance = `\n\nAvailable scopes you can create content in:\n${availableScopes.map(s => `- ${s.id}: ${s.path}`).join('\n')}\n`;
1272
+ scopeGuidance = `\n**Available Scopes:**\n${availableScopes.map(s => `- **${s.id}**: ${s.path}`).join('\n')}\n`;
854
1273
  }
855
1274
  }
856
- guidance += `To create this content, use the qik_create_content tool with:\n`;
857
- guidance += `- type: "${contentType}"\n`;
858
- guidance += `- title: "Your title here"\n`;
859
- guidance += `- meta: { "scopes": ["scope_id_here"] } (required)\n`;
860
- guidance += `- data: { /* field values */ }\n`;
1275
+ guidance += `\n**TO CREATE THIS CONTENT:**\n`;
1276
+ guidance += `Use \`qik_create_content\` with:\n`;
1277
+ guidance += `- **type**: "${contentType}"\n`;
1278
+ guidance += `- **title**: "Your title here"\n`;
1279
+ guidance += `- **meta**: { "scopes": ["scope_id_here"] } *(required)*\n`;
1280
+ guidance += `- **data**: { /* field values based on structure above */ }\n`;
861
1281
  guidance += scopeGuidance;
862
- return {
863
- content: [{
864
- type: 'text',
865
- text: guidance,
866
- }],
867
- };
1282
+ // Add specific guidance for common types
1283
+ if (contentType === 'definition') {
1284
+ guidance += `\n**WORKFLOW DEFINITION EXAMPLE:**\n`;
1285
+ guidance += `For workflow definitions, include the workflow structure in the data field with columns, steps, and automation rules.\n`;
1286
+ }
1287
+ if (contentType.includes('comment') || contentType.includes('Comment')) {
1288
+ guidance += `\n**COMMENT CREATION:**\n`;
1289
+ guidance += `Comments require a reference to the item being commented on. Include:\n`;
1290
+ guidance += `- **reference**: ID of the item to comment on\n`;
1291
+ guidance += `- **referenceType**: Type of the referenced item\n`;
1292
+ }
1293
+ return guidance;
1294
+ }
1295
+ generateToolDescription(baseDescription, emoji = '') {
1296
+ const prefix = emoji ? `${emoji} ` : '';
1297
+ return `${prefix}${baseDescription.replace(/Qik/g, this.serverName)}`;
868
1298
  }
869
1299
  setupToolHandlers() {
870
1300
  this.server.setRequestHandler(ListToolsRequestSchema, async () => {
@@ -874,7 +1304,7 @@ EXAMPLES:
874
1304
  // Authentication & Session
875
1305
  {
876
1306
  name: 'qik_get_user_session',
877
- description: 'Get current user session information',
1307
+ description: this.generateToolDescription('Get current user session information', '👤'),
878
1308
  inputSchema: {
879
1309
  type: 'object',
880
1310
  properties: {},
@@ -883,7 +1313,7 @@ EXAMPLES:
883
1313
  // Content Type Discovery
884
1314
  {
885
1315
  name: 'qik_get_glossary',
886
- description: 'Get all available content types and their definitions',
1316
+ description: this.generateToolDescription('Get all available content types and their definitions', '📚'),
887
1317
  inputSchema: {
888
1318
  type: 'object',
889
1319
  properties: {},
@@ -891,7 +1321,7 @@ EXAMPLES:
891
1321
  },
892
1322
  {
893
1323
  name: 'qik_get_content_definition',
894
- description: 'Get definition for a specific content type',
1324
+ description: this.generateToolDescription('Get definition for a specific content type', '🔍'),
895
1325
  inputSchema: {
896
1326
  type: 'object',
897
1327
  properties: {
@@ -907,7 +1337,7 @@ EXAMPLES:
907
1337
  // Content Management
908
1338
  {
909
1339
  name: 'qik_get_content',
910
- description: 'Get content item by ID or slug',
1340
+ description: this.generateToolDescription('Get content item by ID or slug', '📄'),
911
1341
  inputSchema: {
912
1342
  type: 'object',
913
1343
  properties: {
@@ -928,7 +1358,27 @@ EXAMPLES:
928
1358
  },
929
1359
  {
930
1360
  name: 'qik_list_content',
931
- description: 'List content items with advanced filtering and search capabilities. Supports complex queries like birthdays, date ranges, and sophisticated business logic.',
1361
+ description: this.generateToolDescription(`List content items with advanced filtering and search capabilities. Supports complex queries like birthdays, date ranges, and sophisticated business logic.
1362
+
1363
+ **ENHANCED FILTER CAPABILITIES:**
1364
+ - 40+ comparators for dates, strings, numbers, and arrays
1365
+ - Hierarchical filters with 'and', 'or', 'nor' operators
1366
+ - Anniversary and birthday queries (anniversarynext, anniversarypast)
1367
+ - Date range filtering (datebetween, datepast, datenext)
1368
+ - String matching (contains, startswith, endswith, equal)
1369
+ - Numeric comparisons (greater, lesser, between)
1370
+ - Array operations (in, notin, valuesgreater)
1371
+
1372
+ **COMMON USE CASES:**
1373
+ - Find birthdays in next 10 days: {"operator":"and","filters":[{"key":"dob","comparator":"anniversarynext","value":10,"value2":"days"}]}
1374
+ - Recent content: {"operator":"and","filters":[{"key":"meta.created","comparator":"datepast","value":30,"value2":"days"}]}
1375
+ - Gender filtering: {"operator":"and","filters":[{"key":"gender","comparator":"equal","value":"male"}]}
1376
+ - Complex queries with OR logic for multiple conditions
1377
+
1378
+ **FIELD TARGETING:**
1379
+ - Use dot notation for nested fields: "meta.created", "data.customField"
1380
+ - Target specific profile fields: "firstName", "lastName", "emails"
1381
+ - Filter by metadata: "meta.scopes", "meta.tags", "meta.security"`, '📋'),
932
1382
  inputSchema: {
933
1383
  type: 'object',
934
1384
  properties: {
@@ -939,28 +1389,50 @@ EXAMPLES:
939
1389
  },
940
1390
  search: {
941
1391
  type: 'string',
942
- description: 'Search keywords',
1392
+ description: 'Search keywords - searches within title, tags, and text areas',
943
1393
  },
944
1394
  filter: this.generateEnhancedFilterSchema(),
945
1395
  sort: {
946
1396
  type: 'object',
1397
+ description: 'Sorting configuration for results',
947
1398
  properties: {
948
- key: { type: 'string' },
949
- direction: { type: 'string', enum: ['asc', 'desc'] },
950
- type: { type: 'string', enum: ['string', 'number', 'date'] },
1399
+ key: {
1400
+ type: 'string',
1401
+ description: 'Field to sort by (e.g., "title", "meta.created", "data.customField")'
1402
+ },
1403
+ direction: {
1404
+ type: 'string',
1405
+ enum: ['asc', 'desc'],
1406
+ description: 'Sort direction: ascending or descending'
1407
+ },
1408
+ type: {
1409
+ type: 'string',
1410
+ enum: ['string', 'number', 'date'],
1411
+ description: 'Data type for proper sorting behavior'
1412
+ },
951
1413
  },
952
1414
  },
953
1415
  page: {
954
1416
  type: 'object',
1417
+ description: 'Pagination settings',
955
1418
  properties: {
956
- size: { type: 'number', minimum: 1, maximum: 100 },
957
- index: { type: 'number', minimum: 1 },
1419
+ size: {
1420
+ type: 'number',
1421
+ minimum: 1,
1422
+ maximum: 100,
1423
+ description: 'Number of items per page (1-100)'
1424
+ },
1425
+ index: {
1426
+ type: 'number',
1427
+ minimum: 1,
1428
+ description: 'Page number to retrieve (starts at 1)'
1429
+ },
958
1430
  },
959
1431
  },
960
1432
  select: {
961
1433
  type: 'array',
962
1434
  items: { type: 'string' },
963
- description: 'Fields to include in response',
1435
+ description: 'Specific fields to include in response (e.g., ["title", "data.make", "meta.created"])',
964
1436
  },
965
1437
  },
966
1438
  required: ['type'],
@@ -968,39 +1440,67 @@ EXAMPLES:
968
1440
  },
969
1441
  {
970
1442
  name: 'qik_create_content',
971
- description: 'Create new content item. IMPORTANT: Fields are structured based on content type - some go at root level, others in data object.',
1443
+ description: this.generateToolDescription(`Create new content item with intelligent field structure handling.
1444
+
1445
+ **FIELD STRUCTURE INTELLIGENCE:**
1446
+ - Automatically separates root-level fields from data object fields
1447
+ - Handles comment inheritance (comments inherit scopes from referenced items)
1448
+ - Validates field requirements based on content type definitions
1449
+ - Supports workflow definitions, workflow cards, and all content types
1450
+
1451
+ **FIELD PLACEMENT RULES:**
1452
+ - **Root Level**: reference, referenceType, body, organisation, title, meta
1453
+ - **Data Object**: Custom fields defined in content type definitions (definedFields)
1454
+ - **Meta Object**: scopes (required), tags, security, personaAuthor, etc.
1455
+
1456
+ **CONTENT TYPE EXAMPLES:**
1457
+ - **Comments**: Require reference + referenceType, inherit scopes automatically
1458
+ - **Workflow Definitions**: Use data object for workflow structure (columns, steps, automation)
1459
+ - **Workflow Cards**: Reference profiles, link to workflow definitions
1460
+ - **Profiles**: firstName, lastName at root, custom fields in data object
1461
+ - **Articles**: body at root level, custom article fields in data object
1462
+
1463
+ **SCOPE INHERITANCE:**
1464
+ - Comments automatically inherit scopes from referenced items
1465
+ - Other content types require explicit scope assignment
1466
+ - Use qik_get_scopes to find available scopes with permissions
1467
+
1468
+ **VALIDATION:**
1469
+ - Checks content type exists and user has access
1470
+ - Validates required fields based on content type definition
1471
+ - Ensures proper field placement (root vs data object)`, '✨'),
972
1472
  inputSchema: {
973
1473
  type: 'object',
974
1474
  properties: {
975
1475
  type: {
976
1476
  type: 'string',
977
- description: 'Content type to create',
1477
+ description: 'Content type to create (use qik_get_glossary to see all available types)',
978
1478
  enum: Object.keys(this.glossary),
979
1479
  },
980
1480
  title: {
981
1481
  type: 'string',
982
- description: 'Content title',
1482
+ description: 'Content title (required for all content types)',
983
1483
  },
984
1484
  // Generate dynamic properties based on content types
985
1485
  ...this.generateDynamicContentProperties(),
986
1486
  meta: {
987
1487
  type: 'object',
988
- description: 'Meta information (scopes, tags, etc.)',
1488
+ description: 'Meta information (scopes required for most content types)',
989
1489
  properties: {
990
1490
  scopes: {
991
1491
  type: 'array',
992
1492
  items: { type: 'string' },
993
- description: 'Scope IDs where this content should be stored',
1493
+ description: 'Scope IDs where this content should be stored (REQUIRED - use qik_get_scopes to find available)',
994
1494
  },
995
1495
  tags: {
996
1496
  type: 'array',
997
1497
  items: { type: 'string' },
998
- description: 'Tag IDs for this content',
1498
+ description: 'Tag IDs for categorization and search',
999
1499
  },
1000
1500
  security: {
1001
1501
  type: 'string',
1002
1502
  enum: ['public', 'secure', 'private'],
1003
- description: 'Security level for this content',
1503
+ description: 'Security level: public (everyone), secure (authenticated), private (restricted)',
1004
1504
  },
1005
1505
  },
1006
1506
  },
@@ -1010,7 +1510,7 @@ EXAMPLES:
1010
1510
  },
1011
1511
  {
1012
1512
  name: 'qik_update_content',
1013
- description: 'Update existing content item',
1513
+ description: this.generateToolDescription('Update existing content item', '✏️'),
1014
1514
  inputSchema: {
1015
1515
  type: 'object',
1016
1516
  properties: {
@@ -1033,7 +1533,7 @@ EXAMPLES:
1033
1533
  },
1034
1534
  {
1035
1535
  name: 'qik_delete_content',
1036
- description: 'Delete content item',
1536
+ description: this.generateToolDescription('Delete content item', '🗑️'),
1037
1537
  inputSchema: {
1038
1538
  type: 'object',
1039
1539
  properties: {
@@ -1048,7 +1548,7 @@ EXAMPLES:
1048
1548
  // Profile Management
1049
1549
  {
1050
1550
  name: 'qik_list_profiles',
1051
- description: 'Search and list profiles/people',
1551
+ description: this.generateToolDescription('Search and list profiles/people', '👥'),
1052
1552
  inputSchema: {
1053
1553
  type: 'object',
1054
1554
  properties: {
@@ -1072,7 +1572,7 @@ EXAMPLES:
1072
1572
  },
1073
1573
  {
1074
1574
  name: 'qik_create_profile',
1075
- description: 'Create new profile/person',
1575
+ description: this.generateToolDescription('Create new profile/person', '👤'),
1076
1576
  inputSchema: {
1077
1577
  type: 'object',
1078
1578
  properties: {
@@ -1116,7 +1616,7 @@ EXAMPLES:
1116
1616
  // Form Management
1117
1617
  {
1118
1618
  name: 'qik_get_form',
1119
- description: 'Get form definition',
1619
+ description: this.generateToolDescription('Get form definition', '📝'),
1120
1620
  inputSchema: {
1121
1621
  type: 'object',
1122
1622
  properties: {
@@ -1130,7 +1630,7 @@ EXAMPLES:
1130
1630
  },
1131
1631
  {
1132
1632
  name: 'qik_submit_form',
1133
- description: 'Submit form data',
1633
+ description: this.generateToolDescription('Submit form data', '📤'),
1134
1634
  inputSchema: {
1135
1635
  type: 'object',
1136
1636
  properties: {
@@ -1149,7 +1649,7 @@ EXAMPLES:
1149
1649
  // File Management
1150
1650
  {
1151
1651
  name: 'qik_upload_file',
1152
- description: 'Upload file to Qik',
1652
+ description: this.generateToolDescription('Upload file to platform', '📁'),
1153
1653
  inputSchema: {
1154
1654
  type: 'object',
1155
1655
  properties: {
@@ -1180,7 +1680,7 @@ EXAMPLES:
1180
1680
  // Search & Discovery
1181
1681
  {
1182
1682
  name: 'qik_search_content',
1183
- description: 'Global content search across all types',
1683
+ description: this.generateToolDescription('Global content search across all types', '🔎'),
1184
1684
  inputSchema: {
1185
1685
  type: 'object',
1186
1686
  properties: {
@@ -1208,7 +1708,7 @@ EXAMPLES:
1208
1708
  },
1209
1709
  {
1210
1710
  name: 'qik_get_scopes',
1211
- description: 'Get available scopes/permissions tree',
1711
+ description: this.generateToolDescription('Get available scopes/permissions tree', '🔐'),
1212
1712
  inputSchema: {
1213
1713
  type: 'object',
1214
1714
  properties: {},
@@ -1217,7 +1717,7 @@ EXAMPLES:
1217
1717
  // Utility Tools
1218
1718
  {
1219
1719
  name: 'qik_get_smartlist',
1220
- description: 'Execute a smartlist query',
1720
+ description: this.generateToolDescription('Execute a smartlist query', '📊'),
1221
1721
  inputSchema: {
1222
1722
  type: 'object',
1223
1723
  properties: {
@@ -1229,28 +1729,70 @@ EXAMPLES:
1229
1729
  required: ['id'],
1230
1730
  },
1231
1731
  },
1232
- // Intelligent Content Creation
1732
+ // Intelligent Content Creation with Advanced Disambiguation
1233
1733
  {
1234
1734
  name: 'qik_create_content_intelligent',
1235
- description: 'Intelligently create content by description (e.g., "create an incident report", "make a new event")',
1735
+ description: this.generateToolDescription(`Intelligently create content with advanced disambiguation logic.
1736
+
1737
+ **WORKFLOW DISAMBIGUATION:**
1738
+ - "create a workflow" → Creates workflow DEFINITION (template)
1739
+ - "add Jim to workflow X" → Creates workflow CARD (instance)
1740
+ - "design student onboarding workflow" → Creates workflow DEFINITION
1741
+ - "assign Sarah to project workflow" → Creates workflow CARD
1742
+
1743
+ **CONTENT TYPE DISAMBIGUATION:**
1744
+ - Automatically detects intent between definitions vs instances
1745
+ - Provides comprehensive guidance for workflow systems
1746
+ - Categorizes content types for better organization
1747
+ - Handles scope permissions and requirements
1748
+
1749
+ **EXAMPLES:**
1750
+ - "create an incident report" → Finds incident report content type
1751
+ - "make a new workflow" → Guides through workflow definition creation
1752
+ - "add person to existing workflow" → Guides through workflow card creation
1753
+ - "design a student induction process" → Creates workflow definition
1754
+
1755
+ **WORKFLOW CONCEPTS EXPLAINED:**
1756
+ - **Workflow Definition**: Template with columns, steps, automation rules
1757
+ - **Workflow Card**: Individual items that move through the workflow
1758
+ - **Columns**: Stages like "To Do", "In Progress", "Done"
1759
+ - **Steps**: Specific positions within columns
1760
+ - **Automation**: Entry/exit/success/fail functions`, '🧠'),
1236
1761
  inputSchema: {
1237
1762
  type: 'object',
1238
1763
  properties: {
1239
1764
  description: {
1240
1765
  type: 'string',
1241
- description: 'Natural language description of what to create (e.g., "incident report", "event", "article")',
1766
+ description: 'Natural language description of what to create. Examples: "create an incident report", "make a new workflow", "add Jim to student workflow", "design onboarding process"',
1242
1767
  },
1243
1768
  title: {
1244
1769
  type: 'string',
1245
- description: 'Title for the content',
1770
+ description: 'Title for the content (optional - will be requested if needed)',
1246
1771
  },
1247
1772
  data: {
1248
1773
  type: 'object',
1249
- description: 'Content data fields',
1774
+ description: 'Content data fields (optional - will be guided through structure)',
1250
1775
  },
1251
1776
  meta: {
1252
1777
  type: 'object',
1253
- description: 'Meta information (scopes, tags, etc.)',
1778
+ description: 'Meta information including scopes, tags, security level (will be guided through requirements)',
1779
+ properties: {
1780
+ scopes: {
1781
+ type: 'array',
1782
+ items: { type: 'string' },
1783
+ description: 'Scope IDs where content should be created'
1784
+ },
1785
+ tags: {
1786
+ type: 'array',
1787
+ items: { type: 'string' },
1788
+ description: 'Tag IDs for categorization'
1789
+ },
1790
+ security: {
1791
+ type: 'string',
1792
+ enum: ['public', 'secure', 'private'],
1793
+ description: 'Security level for the content'
1794
+ }
1795
+ }
1254
1796
  },
1255
1797
  },
1256
1798
  required: ['description'],