@@ -111,53 +111,56 @@ export async function createModulesTool () {
111111 return tools
112112}
113113
114- export async function createModuleTools ( ) {
115- const tools : ToolsDictionary = { }
116- const { modules } = await apiDocsService . getApiDocsModules ( )
117-
118- modules . forEach ( ( module ) => {
119- const { name, textRaw } = module
120- const toolName = apiDocsService . normalizeModuleName ( name )
121-
122- logger . info ( { msg : `Creating tool: ${ toolName } ` } )
123-
124- const descFormatted = `Node.js API: ${ textRaw } `
125-
126- // eslint-disable-next-line security/detect-object-injection
127- tools [ toolName ] = {
128- name : toolName ,
129- description : descFormatted ,
130- inputSchema : {
131- type : 'object' ,
132- properties : {
133- class : {
134- type : 'string' ,
135- description : 'The class name to search for.' ,
136- } ,
137- method : {
138- type : 'string' ,
139- description : 'The method name to search for.' ,
140- } ,
141- required : false ,
142- } ,
143- } ,
144- async handler ( params ) {
145- logger . info ( { msg : `Tool execution started: ${ toolName } ` , params } )
146- try {
147- const content = await apiDocsService . getFormattedModuleDoc ( module , params )
148- logger . info ( { msg : `Tool execution successful: ${ toolName } ` } )
149- return { content : [ { type : 'text' , text : content } ] }
150- } catch ( error ) {
151- logger . error ( {
152- err : error ,
153- params,
154- msg : `Tool execution failed: ${ toolName } ` ,
155- } )
156- throw error
157- }
158- } ,
159- }
160- } )
161-
162- return tools
163- }
114+ //
115+ // Note: Archived in favor of a single tool that serves all modules
116+ //
117+ // export async function createModuleTools () {
118+ // const tools: ToolsDictionary = {}
119+ // const { modules } = await apiDocsService.getApiDocsModules()
120+
121+ // modules.forEach((module) => {
122+ // const { name, textRaw } = module
123+ // const toolName = apiDocsService.normalizeModuleName(name)
124+
125+ // logger.info({ msg: `Creating tool: ${toolName}` })
126+
127+ // const descFormatted = `Node.js API: ${textRaw}`
128+
129+ // // eslint-disable-next-line security/detect-object-injection
130+ // tools[toolName] = {
131+ // name: toolName,
132+ // description: descFormatted,
133+ // inputSchema: {
134+ // type: 'object',
135+ // properties: {
136+ // class: {
137+ // type: 'string',
138+ // description: 'The class name to search for.',
139+ // },
140+ // method: {
141+ // type: 'string',
142+ // description: 'The method name to search for.',
143+ // },
144+ // required: false,
145+ // },
146+ // },
147+ // async handler (params) {
148+ // logger.info({ msg: `Tool execution started: ${toolName}`, params })
149+ // try {
150+ // const content = await apiDocsService.getFormattedModuleDoc(module, params)
151+ // logger.info({ msg: `Tool execution successful: ${toolName}` })
152+ // return { content: [{ type: 'text', text: content }] }
153+ // } catch (error) {
154+ // logger.error({
155+ // err: error,
156+ // params,
157+ // msg: `Tool execution failed: ${toolName}`,
158+ // })
159+ // throw error
160+ // }
161+ // },
162+ // }
163+ // })
164+
165+ // return tools
166+ // }
0 commit comments