Coverage for src/qdrant_loader_mcp_server/mcp/schemas/search.py: 100%

3 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-09-08 06:06 +0000

1from typing import Any 

2 

3 

4def get_search_tool_schema() -> dict[str, Any]: 

5 return { 

6 "name": "search", 

7 "description": "Perform semantic search across multiple data sources", 

8 "annotations": {"read-only": True}, 

9 "inputSchema": { 

10 "type": "object", 

11 "properties": { 

12 "query": { 

13 "type": "string", 

14 "description": "The search query in natural language", 

15 "minLength": 1, 

16 }, 

17 "source_types": { 

18 "type": "array", 

19 "items": { 

20 "type": "string", 

21 "enum": [ 

22 "git", 

23 "confluence", 

24 "jira", 

25 "documentation", 

26 "localfile", 

27 ], 

28 }, 

29 "description": "Optional list of source types to filter results", 

30 "minItems": 1, 

31 "uniqueItems": True, 

32 }, 

33 "project_ids": { 

34 "type": "array", 

35 "items": {"type": "string"}, 

36 "description": "Optional list of project IDs to filter results", 

37 "minItems": 1, 

38 "uniqueItems": True, 

39 }, 

40 "limit": { 

41 "type": "integer", 

42 "description": "Maximum number of results to return", 

43 "default": 5, 

44 "minimum": 1, 

45 }, 

46 }, 

47 "required": ["query"], 

48 "additionalProperties": False, 

49 }, 

50 "outputSchema": { 

51 "type": "object", 

52 "additionalProperties": False, 

53 "properties": { 

54 "results": { 

55 "type": "array", 

56 "minItems": 0, 

57 "items": { 

58 "type": "object", 

59 # Allow extra fields for richer result payloads (e.g., document_id, content_snippet, source_url) 

60 "additionalProperties": True, 

61 "properties": { 

62 "score": {"type": "number"}, 

63 "title": {"type": "string"}, 

64 "content": {"type": "string"}, 

65 "source_type": { 

66 "type": "string", 

67 "enum": [ 

68 "git", 

69 "confluence", 

70 "jira", 

71 "documentation", 

72 "localfile", 

73 ], 

74 }, 

75 "metadata": { 

76 "type": "object", 

77 # Allow flexible metadata keys; formatter may include breadcrumb, hierarchy, etc. 

78 "additionalProperties": True, 

79 "properties": { 

80 "file_path": {"type": "string"}, 

81 "project_id": {"type": "string"}, 

82 "created_at": { 

83 "type": "string", 

84 "format": "date-time", 

85 }, 

86 "last_modified": { 

87 "type": "string", 

88 "format": "date-time", 

89 }, 

90 }, 

91 }, 

92 }, 

93 "required": [ 

94 "score", 

95 "title", 

96 "content", 

97 "source_type", 

98 "metadata", 

99 ], 

100 }, 

101 }, 

102 "total_found": {"type": "integer", "minimum": 0}, 

103 "query_context": { 

104 "type": "object", 

105 "additionalProperties": False, 

106 "properties": { 

107 "original_query": {"type": "string"}, 

108 "source_types_filtered": { 

109 "type": "array", 

110 "items": {"type": "string"}, 

111 }, 

112 "project_ids_filtered": { 

113 "type": "array", 

114 "items": {"type": "string"}, 

115 }, 

116 }, 

117 }, 

118 }, 

119 "required": ["results", "total_found"], 

120 }, 

121 }