@@ -30,7 +30,7 @@ export class AAPOperationObject implements OpenAPIV3.OperationObject {
3030 public parameters ?: OpenAPIV3 . ParameterObject [ ] ;
3131 public responses : OpenAPIV3 . ResponsesObject ;
3232
33- constructor ( rawOperation : any ) {
33+ constructor ( rawOperation : Partial < OpenAPIV3 . OperationObject > ) {
3434 Object . assign ( this , rawOperation ) ;
3535 this . deprecated = rawOperation . deprecated || false ;
3636 this . responses = rawOperation . responses || { } ;
@@ -41,7 +41,7 @@ export class AAPOperationObject implements OpenAPIV3.OperationObject {
4141/**
4242 * Normalize a value to boolean if it looks like a boolean; otherwise undefined.
4343 */
44- export function normalizeBoolean ( value : any ) : boolean | undefined {
44+ export function normalizeBoolean ( value : unknown ) : boolean | undefined {
4545 if ( typeof value === "boolean" ) return value ;
4646 if ( typeof value === "string" ) {
4747 const normalized = value . trim ( ) . toLowerCase ( ) ;
@@ -62,7 +62,7 @@ export function shouldIncludeOperationForMcp(
6262 operation : AAPOperationObject ,
6363 defaultInclude = true ,
6464) : boolean {
65- const opRaw = ( operation as any ) [ "x-mcp" ] ;
65+ const opRaw = ( operation as Record < string , unknown > ) [ "x-mcp" ] ;
6666 const opVal = normalizeBoolean ( opRaw ) ;
6767 if ( typeof opVal !== "undefined" ) return opVal ;
6868 if ( typeof opRaw !== "undefined" ) {
@@ -72,7 +72,7 @@ export function shouldIncludeOperationForMcp(
7272 `-> expected boolean or 'true'/'false'. Falling back to path/root/default.` ,
7373 ) ;
7474 }
75- const pathRaw = ( pathItem as any ) [ "x-mcp" ] ;
75+ const pathRaw = ( pathItem as Record < string , unknown > ) [ "x-mcp" ] ;
7676 const pathVal = normalizeBoolean ( pathRaw ) ;
7777 if ( typeof pathVal !== "undefined" ) return pathVal ;
7878 if ( typeof pathRaw !== "undefined" ) {
@@ -82,7 +82,7 @@ export function shouldIncludeOperationForMcp(
8282 `-> expected boolean or 'true'/'false'. Falling back to root/default.` ,
8383 ) ;
8484 }
85- const rootRaw = ( api as any ) [ "x-mcp" ] ;
85+ const rootRaw = ( api as Record < string , unknown > ) [ "x-mcp" ] ;
8686 const rootVal = normalizeBoolean ( rootRaw ) ;
8787 if ( typeof rootVal !== "undefined" ) return rootVal ;
8888 if ( typeof rootRaw !== "undefined" ) {
@@ -148,14 +148,14 @@ export function mapOpenApiSchemaToJsonSchema(
148148 // Detect cycles
149149 if ( seen . has ( schema ) ) {
150150 console . warn (
151- `Cycle detected in schema${ ( schema as any ) . title ? ` "${ ( schema as any ) . title } "` : "" } , returning generic object to break recursion.` ,
151+ `Cycle detected in schema${ ( schema as Record < string , unknown > ) . title ? ` "${ ( schema as Record < string , unknown > ) . title } "` : "" } , returning generic object to break recursion.` ,
152152 ) ;
153153 return { type : "object" } ;
154154 }
155155 seen . add ( schema ) ;
156156 try {
157157 // Create a copy of the schema to modify
158- const jsonSchema : any = { ...schema } ;
158+ const jsonSchema : Record < string , unknown > = { ...schema } ;
159159 // Convert integer type to number (JSON Schema compatible)
160160 if ( schema . type === "integer" ) jsonSchema . type = "number" ;
161161 // Remove OpenAPI-specific properties that aren't in JSON Schema
@@ -167,7 +167,7 @@ export function mapOpenApiSchemaToJsonSchema(
167167 delete jsonSchema . readOnly ;
168168 delete jsonSchema . writeOnly ;
169169 // Handle nullable properties by adding null to the type
170- if ( ( schema as any ) . nullable ) {
170+ if ( ( schema as Record < string , unknown > ) . nullable ) {
171171 if ( Array . isArray ( jsonSchema . type ) ) {
172172 if ( ! jsonSchema . type . includes ( "null" ) ) jsonSchema . type . push ( "null" ) ;
173173 } else if ( typeof jsonSchema . type === "string" ) {
@@ -178,11 +178,11 @@ export function mapOpenApiSchemaToJsonSchema(
178178 }
179179 // Recursively process object properties
180180 if ( jsonSchema . type === "object" && jsonSchema . properties ) {
181- const mappedProps : any = { } ;
181+ const mappedProps : Record < string , JSONSchema7 | boolean > = { } ;
182182 for ( const [ key , propSchema ] of Object . entries ( jsonSchema . properties ) ) {
183183 if ( typeof propSchema === "object" && propSchema !== null ) {
184184 mappedProps [ key ] = mapOpenApiSchemaToJsonSchema (
185- propSchema as any ,
185+ propSchema as OpenAPIV3 . SchemaObject | OpenAPIV3 . ReferenceObject ,
186186 seen ,
187187 ) ;
188188 } else if ( typeof propSchema === "boolean" ) {
@@ -198,7 +198,7 @@ export function mapOpenApiSchemaToJsonSchema(
198198 jsonSchema . items !== null
199199 ) {
200200 jsonSchema . items = mapOpenApiSchemaToJsonSchema (
201- jsonSchema . items as any ,
201+ jsonSchema . items as OpenAPIV3 . SchemaObject | OpenAPIV3 . ReferenceObject ,
202202 seen ,
203203 ) ;
204204 }
@@ -358,9 +358,9 @@ export function extractToolsFromApi(
358358 } catch ( error ) {
359359 const loc = operation . operationId || `${ method } ${ path } ` ;
360360 const extVal =
361- ( operation as any ) [ "x-mcp" ] ??
362- ( pathItem as any ) [ "x-mcp" ] ??
363- ( api as any ) [ "x-mcp" ] ;
361+ ( operation as Record < string , unknown > ) [ "x-mcp" ] ??
362+ ( pathItem as Record < string , unknown > ) [ "x-mcp" ] ??
363+ ( api as Record < string , unknown > ) [ "x-mcp" ] ;
364364 let extPreview : string ;
365365 try {
366366 extPreview = JSON . stringify ( extVal ) ;
@@ -438,7 +438,7 @@ export function extractToolsFromApi(
438438 ( value ) => value [ 1 ] ,
439439 ) ;
440440 const missingDescriptions = propertiesEntries . filter (
441- ( p : any ) => p && typeof p === "object" && ! p . description ,
441+ ( p : JSONSchema7 | boolean ) => p && typeof p === "object" && ! ( p as JSONSchema7 ) . description ,
442442 ) ;
443443 if ( missingDescriptions . length ) {
444444 logs . push ( {
0 commit comments