{"record":{"id":"e24eb948a75598ec","repo":"ComposioHQ/composio","slug":"invalid-schema-modifier-not-a-function-e24eb9","errorCode":null,"errorMessage":"Invalid schema modifier. Not a function.","messagePattern":"Invalid schema modifier\\. Not a function\\.","errorType":"exception","errorClass":"ComposioInvalidModifierError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/Tools.ts","lineNumber":578,"sourceCode":"    }\n    const caseTransformedTools = tools.items.map(tool => this.transformToolCases(tool));\n\n    let modifiedTools = await this.applyDefaultSchemaModifiers(caseTransformedTools);\n\n    // apply local modifiers if they are provided\n    if (options?.modifySchema) {\n      const modifier = options.modifySchema;\n      if (typeof modifier === 'function') {\n        const modifiedPromises = modifiedTools.map(tool =>\n          modifier({\n            toolSlug: tool.slug,\n            toolkitSlug: tool.toolkit?.slug ?? 'unknown',\n            schema: tool,\n          })\n        );\n        modifiedTools = await Promise.all(modifiedPromises);\n      } else {\n        throw new ComposioInvalidModifierError('Invalid schema modifier. Not a function.');\n      }\n    }\n\n    return modifiedTools;\n  }\n\n  /**\n   * Fetches tools exposed by a tool router session.\n   * This includes helper/meta tools plus any tools preloaded into the session.\n   * It provides access to the underlying tool data without provider-specific wrapping.\n   *\n   * @param sessionId {string} The session id to get tools for\n   * @param options {SchemaModifierOptions} Optional configuration for tool retrieval\n   * @param {TransformToolSchemaModifier} [options.modifySchema] - Function to transform the tool schema\n   * @returns {Promise<ToolList>} The list of session tools\n   *\n   * @example\n   * ```typescript","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/Tools.ts#L560-L596","documentation":"ComposioInvalidModifierError thrown in getRawComposioTools when a schema modifier is supplied to the tools listing call but is not a function. The SDK validates the modifier before mapping it over the returned tools.","triggerScenarios":"Calling composio.tools.get(query, modifier) or wiring .with({ schemaModifier: ... }) where modifier is null, a string, or an object rather than ({ toolSlug, toolkitSlug, schema }) => schema.","commonSituations":"Passing modifier config objects from JSON, version mismatch in modifier signature shape, accidental double-wrapping of the modifier.","solutions":["Ensure the second argument to tools.get is a function ({ toolSlug, toolkitSlug, schema }) => schema","Check typeof modifier where you build the call","Update to the current modifier callback signature"],"exampleFix":"// before\ncomposio.tools.get({ toolkits: ['github'] }, { schemaModifier: 'stripDesc' })\n// after\ncomposio.tools.get({ toolkits: ['github'] }, ({ schema }) => schema)","handlingStrategy":"validation","validationCode":"if (modifier !== undefined && typeof modifier !== 'function') throw new TypeError('modifier must be a function');","typeGuard":"const isSchemaModifier = (m: unknown): m is TransformToolSchemaModifier => typeof m === 'function';","tryCatchPattern":"try { const tools = await composio.tools.get(q, modifier); } catch (e) { if (e instanceof ComposioInvalidModifierError) fixModifier(); else throw e; }","preventionTips":["Pass modifiers as arrow functions only","Type the parameter as TransformToolSchemaModifier"],"tags":["modifiers","validation","typescript"],"backgroundTag":"invalid-callback-modifier","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}