import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { OAuthClientInformationFull, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js'; import { CallToolRequest, Tool } from '@modelcontextprotocol/sdk/types.js'; import type { Trigger, Create, Search, PlainInputField } from 'zapier-platform-core'; export type ClientInstance = InstanceType; export type BearerAuth = { type: 'bearer'; token: string; }; export type OAuthAuth = { type: 'oauth'; clientInformation?: OAuthClientInformationFull; tokens?: OAuthTokens; }; export type Config = { name: string; version: string; serverUrl: string; transport: 'streamable' | 'sse'; auth?: BearerAuth | OAuthAuth; delegateAuth?: boolean; debug?: boolean; readFromDir?: string; transformer?: Transformer; }; export type GetAccessTokenResult = Required & Pick; export type CallToolOptions = CallToolRequest['params'] & { error?: boolean; parse?: boolean; filter?: string; }; export type AppMiddleware = (io: unknown) => Promise; export type Actions = { triggers: Record; creates: Record; searches: Record; }; /** * Valid Zapier input field types */ export declare const INPUT_FIELD_TYPES: PlainInputField["type"][]; /** * Statistics about the generation process */ export interface GenerationStats { /** Number of create actions generated */ createCount: number; /** Number of search actions generated */ searchCount: number; /** Number of trigger actions generated */ triggerCount: number; /** Total number of files generated */ totalFiles: number; /** List of all generated file paths */ generatedFiles: string[]; } /** * Interface for transformation functions used in config.transforms */ export interface Transformer { /** * Transform a tool definition before action generation * This allows modifying tool properties (like annotations) before the * standard logic determines which action types to generate. * @param tool The original MCP tool * @returns The transformed tool or undefined to skip generation entirely */ transformTool?: (tool: Tool) => Tool | undefined; /** * Transform a generated Create action before it's written to disk * @param action The generated Create action * @param tool The original MCP tool * @returns The transformed Create action or undefined to skip */ transformCreate?: (action: Create, tool: Tool) => Create | undefined; /** * Transform a generated Search action before it's written to disk * @param action The generated Search action * @param tool The original MCP tool * @returns The transformed Search action or undefined to skip */ transformSearch?: (action: Search, tool: Tool) => Search | undefined; /** * Transform a generated Trigger action before it's written to disk * @param action The generated Trigger action * @param tool The original MCP tool * @returns The transformed Trigger action or undefined to skip */ transformTrigger?: (action: Trigger, tool: Tool) => Trigger | undefined; /** * Hook called after all files have been generated * @param stats Information about what was generated */ afterGeneration?: (stats: GenerationStats) => void | Promise; } /** * Represents a named import that should be generated in action files */ export interface NamedImport { /** Marker to identify this as an import object */ _isImport: true; /** Path to the module to import from (relative to the generated file) */ path: string; /** Name of the export to import */ name: string; } /** * Represents an individual input field item - either a field object or a named import */ export type InputFieldItem = any | NamedImport; export interface ActionExtender { /** The original action being extended */ action: T; /** * Add input fields after a specific field * @param afterKey The key of the field to insert after * @param fields The fields to insert */ insertFieldsAfter: (afterKey: string, ...fields: any[]) => ActionExtender; /** * Add input fields at the beginning * @param fields The fields to insert */ prependFields: (...fields: any[]) => ActionExtender; /** * Add input fields at the end * @param fields The fields to insert */ appendFields: (...fields: any[]) => ActionExtender; /** * Replace all input fields entirely * @param fields The new fields to set - can mix field objects and named imports */ replaceInputFields: (...fields: InputFieldItem[]) => ActionExtender; /** * Replace all input field groups entirely * @param groups The new field groups to set - can be group objects or named import */ replaceInputFieldGroups: (groups: any[] | NamedImport) => ActionExtender; /** * Replace the perform function with a named import * @param namedImport The named import reference to the perform function */ replacePerform: (namedImport: NamedImport) => ActionExtender; /** * Replace the sample data with a named import * @param namedImport The named import reference to the sample data */ replaceSample: (namedImport: NamedImport) => ActionExtender; /** * Modify an existing input field by key * @param fieldKey The key of the field to modify * @param modifier Function to modify the field */ modifyField: (fieldKey: string, modifier: (field: any) => any) => ActionExtender; /** * Transform all input fields with a general transformation * @param transformer Function to transform each field (return field unchanged to skip) */ transformAllFields: (transformer: (field: any) => any) => ActionExtender; /** * Replace the description for the action * @param description The new description to set */ replaceDescription: (description: string) => ActionExtender; /** * Replace the noun for the action * @param noun The new noun to set */ replaceNoun: (noun: string) => ActionExtender; /** * Replace the help text for a specific input field * @param fieldKey The key of the field to modify * @param helpText The new help text to set for the field */ replaceFieldHelpText: (fieldKey: string, helpText: string) => ActionExtender; /** * Replace the type for a specific input field * @param fieldKey The key of the field to modify * @param fieldType The new field type (must be a valid Zapier field type) */ replaceFieldType: (fieldKey: string, fieldType: string) => ActionExtender; /** * Register dynamic dropdowns for existing input fields based on field key mappings * @param fieldMappings A record mapping field keys to their dynamic dropdown source */ registerDynamicDropdowns: (fieldMappings: Record) => ActionExtender; /** * Build the final action * @returns The modified action */ build: () => T; } /** * Helper function to check if a value is a named import */ export declare function isNamedImport(value: any): value is NamedImport; export interface ToolExtender { /** The original tool being extended */ tool: Tool; /** * Set or update an annotation on the tool * @param key The annotation key to set * @param value The annotation value to set */ setAnnotation: (key: string, value: any) => ToolExtender; /** * Build the final tool * @returns The modified tool */ build: () => Tool; } //# sourceMappingURL=types.d.ts.map