MCPcopy Create free account
hub / github.com/bytebase/dbhub / getToolsForSource

Function getToolsForSource

src/utils/tool-metadata.ts:306–323  ·  view source on GitHub ↗
(sourceId: string)

Source from the content-addressed store, hash-verified

304 * @returns Array of enabled tools with simplified parameters
305 */
306export function getToolsForSource(sourceId: string): Tool[] {
307 // Get enabled tools from registry
308 const registry = getToolRegistry();
309 const enabledToolConfigs = registry.getEnabledToolConfigs(sourceId);
310
311 // Uniform iteration: map each enabled tool config to its API representation
312 return enabledToolConfigs.map((toolConfig) => {
313 // Dispatch based on tool name
314 if (toolConfig.name === "execute_sql") {
315 return buildExecuteSqlTool(sourceId, toolConfig);
316 } else if (toolConfig.name === "search_objects") {
317 return buildSearchObjectsTool(sourceId);
318 } else {
319 // Custom tool
320 return buildCustomTool(toolConfig);
321 }
322 });
323}

Callers 3

mainFunction · 0.85
buildSourceDisplayInfoFunction · 0.85
transformSourceConfigFunction · 0.85

Calls 5

getToolRegistryFunction · 0.85
buildExecuteSqlToolFunction · 0.85
buildSearchObjectsToolFunction · 0.85
buildCustomToolFunction · 0.85
getEnabledToolConfigsMethod · 0.80

Tested by

no test coverage detected