MCPcopy
hub / github.com/codedogQBY/ReadAny / getAvailableTools

Function getAvailableTools

packages/core/src/ai/tools/index.ts:68–117  ·  view source on GitHub ↗
(options: {
  bookId?: string | null;
  isVectorized: boolean;
  enabledSkills: Skill[];
})

Source from the content-addressed store, hash-verified

66
67/** Get available tools based on current state */
68export function getAvailableTools(options: {
69 bookId?: string | null;
70 isVectorized: boolean;
71 enabledSkills: Skill[];
72}): ToolDefinition[] {
73 const tools: ToolDefinition[] = [];
74
75 // General tools are always available (no bookId required)
76 tools.push(...getGeneralTools());
77
78 if (options.bookId) {
79 // Context tools (always available when book is loaded)
80 tools.push(...getContextTools(options.bookId));
81
82 // RAG tools (require vectorization)
83 if (options.isVectorized) {
84 tools.push(
85 createRagSearchTool(options.bookId),
86 createRagTocTool(options.bookId),
87 createRagContextTool(options.bookId),
88 );
89
90 // Content analysis tools (require chunks from vectorization)
91 tools.push(
92 createSummarizeTool(options.bookId),
93 createExtractEntitiesTool(options.bookId),
94 createAnalyzeArgumentsTool(options.bookId),
95 createFindQuotesTool(options.bookId),
96 createCompareSectionsTool(options.bookId),
97 );
98 } else {
99 tools.push(
100 createFallbackTocTool(options.bookId),
101 createFallbackSearchTool(options.bookId),
102 createFallbackChapterContextTool(options.bookId),
103 );
104 }
105
106 // Citations are available for indexed chunks and for fallback sources that
107 // can be validated against concrete reader segments.
108 tools.push(createGetAnnotationsTool(options.bookId), createAddCitationTool(options.bookId));
109 }
110
111 // Add custom skills
112 for (const skill of options.enabledSkills) {
113 tools.push(skillToTool(skill));
114 }
115
116 return tools;
117}

Callers 2

tools.test.tsFile · 0.90
streamReadingAgentFunction · 0.85

Calls 15

getContextToolsFunction · 0.90
createRagSearchToolFunction · 0.90
createRagTocToolFunction · 0.90
createRagContextToolFunction · 0.90
createSummarizeToolFunction · 0.90
createFindQuotesToolFunction · 0.90
createFallbackTocToolFunction · 0.90
createFallbackSearchToolFunction · 0.90

Tested by

no test coverage detected