11import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
2- import { z , ZodRawShape } from "zod"
2+ import {
3+ z , ZodRawShape ,
4+ } from "zod"
35import { createPdClient } from "./pd-client.js"
46import { RunActionOpts } from "@pipedream/sdk"
57import { getAuthProvision } from "./authProvisions.js"
@@ -28,17 +30,23 @@ export async function registerComponentTools({
2830 name : string ,
2931 description : string ,
3032 schema : ZodRawShape ,
31- handler : any
33+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34+ handler : any ,
3235 ) : SafeRegisterToolResult => {
3336 try {
3437 server . tool ( name , description , schema , handler )
35- return { success : true }
38+ return {
39+ success : true ,
40+ }
3641 } catch ( error ) {
3742 if (
3843 error instanceof Error &&
3944 error . message . includes ( "already registered" )
4045 ) {
41- return { success : false , reason : "already_registered" }
46+ return {
47+ success : false ,
48+ reason : "already_registered" ,
49+ }
4250 }
4351 throw error // Re-throw any other errors
4452 }
@@ -78,8 +86,10 @@ export async function registerComponentTools({
7886 z . string ( ) . transform ( ( val ) => {
7987 try {
8088 return JSON . parse ( val )
81- } catch ( e ) {
82- return [ val ] // If not valid JSON, treat as single item array
89+ } catch {
90+ return [
91+ val ,
92+ ] // If not valid JSON, treat as single item array
8393 }
8494 } ) ,
8595 z . array ( z . string ( ) ) ,
@@ -123,10 +133,13 @@ export async function registerComponentTools({
123133 const description = `
124134${ component . description ?? "No description available" }
125135
126- ${ configurablePropsDescription ? "\n\n\n\nIMPORTANT: The arguments have specific formats. Please follow the instructions below:\n" + configurablePropsDescription : "" }
136+ ${ configurablePropsDescription
137+ ? "\n\n\n\nIMPORTANT: The arguments have specific formats. Please follow the instructions below:\n" + configurablePropsDescription
138+ : "" }
127139 ` . trim ( )
128140
129141 // Register the tool for this component
142+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
130143 safeRegisterTool ( component . key , description , schema , async ( _args : any ) => {
131144 const args = z . object ( schema ) . parse ( _args )
132145 const authProvisionResponse = await getAuthProvision ( {
@@ -162,7 +175,7 @@ ${configurablePropsDescription ? "\n\n\n\nIMPORTANT: The arguments have specific
162175 console . log (
163176 "Running action:" ,
164177 component . key ,
165- "for external user: [REDACTED]"
178+ "for external user: [REDACTED]" ,
166179 )
167180 const response = await pd . runAction ( requestOpts )
168181
@@ -186,6 +199,7 @@ ${configurablePropsDescription ? "\n\n\n\nIMPORTANT: The arguments have specific
186199 CONFIGURE_COMPONENT_TOOL_NAME ,
187200 configureComponentDescription ,
188201 ConfigureComponentRawSchema ,
202+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
189203 async ( _args : any ) => {
190204 const args = z . object ( ConfigureComponentRawSchema ) . parse ( _args )
191205 const authProvisionResponse = await getAuthProvision ( {
@@ -226,6 +240,6 @@ ${configurablePropsDescription ? "\n\n\n\nIMPORTANT: The arguments have specific
226240 } ,
227241 ] ,
228242 }
229- }
243+ } ,
230244 )
231245}
0 commit comments