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

3 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-27 11:14 +0000

1from typing import Any 

2 

3 

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

5 """Get expand chunk context tool schema""" 

6 return { 

7 "name": "expand_chunk_context", 

8 "description": "Retrieve neighboring chunks within the same document based on a given chunk_index. This helps expand context around a specific chunk.", 

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

10 "inputSchema": { 

11 "type": "object", 

12 "properties": { 

13 "document_id": { 

14 "type": "string", 

15 "description": "Unique identifier of the document.", 

16 }, 

17 "chunk_index": { 

18 "type": "integer", 

19 "description": "Index of the target chunk within the document.", 

20 "minimum": 0, 

21 }, 

22 "window_size": { 

23 "type": "integer", 

24 "description": "Number of chunks to include before and after the target chunk.", 

25 "default": 2, 

26 "minimum": 0, 

27 }, 

28 }, 

29 "required": ["document_id", "chunk_index"], 

30 }, 

31 "outputSchema": { 

32 "type": "object", 

33 "properties": { 

34 "structured_results": { 

35 "type": "object", 

36 "properties": { 

37 "context_chunks": { 

38 "type": "object", 

39 "properties": { 

40 "pre": { 

41 "type": "array", 

42 "items": {"type": "object"}, 

43 "description": "Chunks before the target chunk.", 

44 }, 

45 "target": { 

46 "type": ["object", "null"], 

47 "description": "The target chunk.", 

48 }, 

49 "post": { 

50 "type": "array", 

51 "items": {"type": "object"}, 

52 "description": "Chunks after the target chunk.", 

53 }, 

54 }, 

55 }, 

56 "metadata": { 

57 "type": "object", 

58 "properties": { 

59 "document_id": {"type": "string"}, 

60 "chunk_index": {"type": "integer"}, 

61 "window_size": {"type": "integer"}, 

62 "context_range": { 

63 "type": "object", 

64 "properties": { 

65 "start": {"type": "integer"}, 

66 "end": {"type": "integer"}, 

67 }, 

68 }, 

69 "total_chunks": {"type": "integer"}, 

70 }, 

71 }, 

72 }, 

73 } 

74 }, 

75 }, 

76 }