@elizaos/plugin-mcp 1.7.0 → 2.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/LICENSE +23 -0
  2. package/dist/cjs/index.cjs +857 -1099
  3. package/dist/cjs/index.d.ts +2 -0
  4. package/dist/cjs/index.js.map +25 -27
  5. package/dist/index.d.ts +2 -7
  6. package/dist/node/actions/callToolAction.d.ts +3 -0
  7. package/dist/node/actions/callToolAction.d.ts.map +1 -0
  8. package/dist/node/actions/readResourceAction.d.ts +3 -0
  9. package/dist/node/actions/readResourceAction.d.ts.map +1 -0
  10. package/dist/node/generated/prompts/typescript/prompts.d.ts +24 -0
  11. package/dist/node/generated/prompts/typescript/prompts.d.ts.map +1 -0
  12. package/dist/node/index.d.ts +4 -0
  13. package/dist/node/index.d.ts.map +1 -0
  14. package/dist/{index.js → node/index.js} +874 -1104
  15. package/dist/node/index.js.map +31 -0
  16. package/dist/node/provider.d.ts.map +1 -0
  17. package/dist/{service.d.ts → node/service.d.ts} +6 -8
  18. package/dist/node/service.d.ts.map +1 -0
  19. package/dist/node/templates/errorAnalysisPrompt.d.ts +2 -0
  20. package/dist/node/templates/errorAnalysisPrompt.d.ts.map +1 -0
  21. package/dist/node/templates/feedbackTemplate.d.ts +8 -0
  22. package/dist/node/templates/feedbackTemplate.d.ts.map +1 -0
  23. package/dist/node/templates/resourceAnalysisTemplate.d.ts +8 -0
  24. package/dist/node/templates/resourceAnalysisTemplate.d.ts.map +1 -0
  25. package/dist/node/templates/resourceSelectionTemplate.d.ts +8 -0
  26. package/dist/node/templates/resourceSelectionTemplate.d.ts.map +1 -0
  27. package/dist/node/templates/toolReasoningTemplate.d.ts +8 -0
  28. package/dist/node/templates/toolReasoningTemplate.d.ts.map +1 -0
  29. package/dist/node/templates/toolSelectionTemplate.d.ts +8 -0
  30. package/dist/node/templates/toolSelectionTemplate.d.ts.map +1 -0
  31. package/dist/{tool-compatibility/index.d.ts → node/tool-compatibility/base.d.ts} +15 -16
  32. package/dist/node/tool-compatibility/base.d.ts.map +1 -0
  33. package/dist/node/tool-compatibility/index.d.ts +7 -0
  34. package/dist/node/tool-compatibility/index.d.ts.map +1 -0
  35. package/dist/node/tool-compatibility/integration-test.d.ts +10 -0
  36. package/dist/node/tool-compatibility/integration-test.d.ts.map +1 -0
  37. package/dist/node/tool-compatibility/providers/anthropic.d.ts +11 -0
  38. package/dist/node/tool-compatibility/providers/anthropic.d.ts.map +1 -0
  39. package/dist/node/tool-compatibility/providers/google.d.ts +11 -0
  40. package/dist/node/tool-compatibility/providers/google.d.ts.map +1 -0
  41. package/dist/node/tool-compatibility/providers/openai.d.ts +18 -0
  42. package/dist/node/tool-compatibility/providers/openai.d.ts.map +1 -0
  43. package/dist/node/tool-compatibility/test-example.d.ts +4 -0
  44. package/dist/node/tool-compatibility/test-example.d.ts.map +1 -0
  45. package/dist/node/types.d.ts +191 -0
  46. package/dist/node/types.d.ts.map +1 -0
  47. package/dist/{utils → node/utils}/error.d.ts +4 -4
  48. package/dist/node/utils/error.d.ts.map +1 -0
  49. package/dist/node/utils/handler.d.ts +8 -0
  50. package/dist/node/utils/handler.d.ts.map +1 -0
  51. package/dist/node/utils/json.d.ts +11 -0
  52. package/dist/node/utils/json.d.ts.map +1 -0
  53. package/dist/node/utils/mcp.d.ts +5 -0
  54. package/dist/node/utils/mcp.d.ts.map +1 -0
  55. package/dist/node/utils/processing.d.ts +43 -0
  56. package/dist/node/utils/processing.d.ts.map +1 -0
  57. package/dist/node/utils/schemas.d.ts +72 -0
  58. package/dist/node/utils/schemas.d.ts.map +1 -0
  59. package/dist/node/utils/selection.d.ts +14 -0
  60. package/dist/node/utils/selection.d.ts.map +1 -0
  61. package/dist/node/utils/validation.d.ts +17 -0
  62. package/dist/node/utils/validation.d.ts.map +1 -0
  63. package/dist/node/utils/wrapper.d.ts +18 -0
  64. package/dist/node/utils/wrapper.d.ts.map +1 -0
  65. package/dist/tsconfig.build.tsbuildinfo +1 -0
  66. package/package.json +37 -45
  67. package/README.md +0 -275
  68. package/dist/actions/callToolAction.d.ts +0 -3
  69. package/dist/actions/callToolAction.d.ts.map +0 -1
  70. package/dist/actions/readResourceAction.d.ts +0 -3
  71. package/dist/actions/readResourceAction.d.ts.map +0 -1
  72. package/dist/index.d.ts.map +0 -1
  73. package/dist/index.js.map +0 -33
  74. package/dist/provider.d.ts.map +0 -1
  75. package/dist/service.d.ts.map +0 -1
  76. package/dist/templates/errorAnalysisPrompt.d.ts +0 -2
  77. package/dist/templates/errorAnalysisPrompt.d.ts.map +0 -1
  78. package/dist/templates/feedbackTemplate.d.ts +0 -2
  79. package/dist/templates/feedbackTemplate.d.ts.map +0 -1
  80. package/dist/templates/resourceAnalysisTemplate.d.ts +0 -2
  81. package/dist/templates/resourceAnalysisTemplate.d.ts.map +0 -1
  82. package/dist/templates/resourceSelectionTemplate.d.ts +0 -2
  83. package/dist/templates/resourceSelectionTemplate.d.ts.map +0 -1
  84. package/dist/templates/toolReasoningTemplate.d.ts +0 -2
  85. package/dist/templates/toolReasoningTemplate.d.ts.map +0 -1
  86. package/dist/templates/toolSelectionTemplate.d.ts +0 -3
  87. package/dist/templates/toolSelectionTemplate.d.ts.map +0 -1
  88. package/dist/tool-compatibility/index.d.ts.map +0 -1
  89. package/dist/tool-compatibility/providers/anthropic.d.ts +0 -12
  90. package/dist/tool-compatibility/providers/anthropic.d.ts.map +0 -1
  91. package/dist/tool-compatibility/providers/google.d.ts +0 -12
  92. package/dist/tool-compatibility/providers/google.d.ts.map +0 -1
  93. package/dist/tool-compatibility/providers/openai.d.ts +0 -20
  94. package/dist/tool-compatibility/providers/openai.d.ts.map +0 -1
  95. package/dist/types.d.ts +0 -166
  96. package/dist/types.d.ts.map +0 -1
  97. package/dist/utils/error.d.ts.map +0 -1
  98. package/dist/utils/handler.d.ts +0 -3
  99. package/dist/utils/handler.d.ts.map +0 -1
  100. package/dist/utils/json.d.ts +0 -9
  101. package/dist/utils/json.d.ts.map +0 -1
  102. package/dist/utils/mcp.d.ts +0 -5
  103. package/dist/utils/mcp.d.ts.map +0 -1
  104. package/dist/utils/processing.d.ts +0 -43
  105. package/dist/utils/processing.d.ts.map +0 -1
  106. package/dist/utils/schemas.d.ts +0 -69
  107. package/dist/utils/schemas.d.ts.map +0 -1
  108. package/dist/utils/selection.d.ts +0 -38
  109. package/dist/utils/selection.d.ts.map +0 -1
  110. package/dist/utils/validation.d.ts +0 -34
  111. package/dist/utils/validation.d.ts.map +0 -1
  112. package/dist/utils/wrapper.d.ts +0 -27
  113. package/dist/utils/wrapper.d.ts.map +0 -1
  114. /package/dist/{provider.d.ts → node/provider.d.ts} +0 -0
@@ -0,0 +1,31 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/tool-compatibility/base.ts", "../../src/tool-compatibility/providers/openai.ts", "../../src/tool-compatibility/providers/anthropic.ts", "../../src/tool-compatibility/providers/google.ts", "../../src/index.ts", "../../src/types.ts", "../../src/utils/error.ts", "../../src/generated/prompts/typescript/prompts.ts", "../../src/templates/errorAnalysisPrompt.ts", "../../src/utils/handler.ts", "../../src/utils/processing.ts", "../../src/utils/mcp.ts", "../../src/utils/selection.ts", "../../src/utils/json.ts", "../../src/utils/schemas.ts", "../../src/utils/validation.ts", "../../src/utils/wrapper.ts", "../../src/actions/callToolAction.ts", "../../src/actions/readResourceAction.ts", "../../src/provider.ts", "../../src/service.ts", "../../src/tool-compatibility/index.ts"],
4
+ "sourcesContent": [
5
+ "import type { IAgentRuntime } from \"@elizaos/core\";\nimport type { JSONSchema7 } from \"json-schema\";\n\nexport interface StringConstraints {\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n format?: string;\n enum?: readonly string[];\n}\n\nexport interface NumberConstraints {\n minimum?: number;\n maximum?: number;\n exclusiveMinimum?: number;\n exclusiveMaximum?: number;\n multipleOf?: number;\n}\n\nexport interface ArrayConstraints {\n minItems?: number;\n maxItems?: number;\n uniqueItems?: boolean;\n}\n\nexport interface ObjectConstraints {\n minProperties?: number;\n maxProperties?: number;\n additionalProperties?: boolean;\n}\n\nexport type SchemaConstraints =\n | StringConstraints\n | NumberConstraints\n | ArrayConstraints\n | ObjectConstraints;\n\n// Model provider detection\nexport type ModelProvider = \"openai\" | \"anthropic\" | \"google\" | \"openrouter\";\n\nexport interface ModelInfo {\n readonly provider: ModelProvider;\n readonly modelId: string;\n readonly supportsStructuredOutputs?: boolean;\n readonly isReasoningModel?: boolean;\n}\n\nexport abstract class McpToolCompatibility {\n protected readonly modelInfo: ModelInfo;\n\n constructor(modelInfo: ModelInfo) {\n this.modelInfo = modelInfo;\n }\n\n abstract shouldApply(): boolean;\n\n public transformToolSchema(toolSchema: JSONSchema7): JSONSchema7 {\n if (!this.shouldApply()) {\n return toolSchema;\n }\n\n return this.processSchema(toolSchema);\n }\n\n protected processSchema(schema: JSONSchema7): JSONSchema7 {\n const processed = { ...schema };\n\n switch (processed.type) {\n case \"string\":\n return this.processStringSchema(processed);\n case \"number\":\n case \"integer\":\n return this.processNumberSchema(processed);\n case \"array\":\n return this.processArraySchema(processed);\n case \"object\":\n return this.processObjectSchema(processed);\n default:\n return this.processGenericSchema(processed);\n }\n }\n\n protected processStringSchema(schema: JSONSchema7): JSONSchema7 {\n const constraints: StringConstraints = {};\n const processed: Record<string, unknown> = { ...schema };\n\n if (typeof schema.minLength === \"number\") {\n constraints.minLength = schema.minLength;\n }\n if (typeof schema.maxLength === \"number\") {\n constraints.maxLength = schema.maxLength;\n }\n if (typeof schema.pattern === \"string\") {\n constraints.pattern = schema.pattern;\n }\n if (typeof schema.format === \"string\") {\n constraints.format = schema.format;\n }\n if (Array.isArray(schema.enum)) {\n constraints.enum = schema.enum as string[];\n }\n\n const unsupportedProps = this.getUnsupportedStringProperties();\n for (const prop of unsupportedProps) {\n if (prop in processed) {\n delete processed[prop];\n }\n }\n\n if (Object.keys(constraints).length > 0) {\n processed.description = this.mergeDescription(schema.description, constraints);\n }\n\n return processed as JSONSchema7;\n }\n\n protected processNumberSchema(schema: JSONSchema7): JSONSchema7 {\n const constraints: NumberConstraints = {};\n const processed: Record<string, unknown> = { ...schema };\n\n if (typeof schema.minimum === \"number\") {\n constraints.minimum = schema.minimum;\n }\n if (typeof schema.maximum === \"number\") {\n constraints.maximum = schema.maximum;\n }\n if (typeof schema.exclusiveMinimum === \"number\") {\n constraints.exclusiveMinimum = schema.exclusiveMinimum;\n }\n if (typeof schema.exclusiveMaximum === \"number\") {\n constraints.exclusiveMaximum = schema.exclusiveMaximum;\n }\n if (typeof schema.multipleOf === \"number\") {\n constraints.multipleOf = schema.multipleOf;\n }\n\n const unsupportedProps = this.getUnsupportedNumberProperties();\n for (const prop of unsupportedProps) {\n if (prop in processed) {\n delete processed[prop];\n }\n }\n\n if (Object.keys(constraints).length > 0) {\n processed.description = this.mergeDescription(schema.description, constraints);\n }\n\n return processed as JSONSchema7;\n }\n\n protected processArraySchema(schema: JSONSchema7): JSONSchema7 {\n const constraints: ArrayConstraints = {};\n const processed: Record<string, unknown> = { ...schema };\n\n if (typeof schema.minItems === \"number\") {\n constraints.minItems = schema.minItems;\n }\n if (typeof schema.maxItems === \"number\") {\n constraints.maxItems = schema.maxItems;\n }\n if (typeof schema.uniqueItems === \"boolean\") {\n constraints.uniqueItems = schema.uniqueItems;\n }\n\n if (schema.items && typeof schema.items === \"object\" && !Array.isArray(schema.items)) {\n processed.items = this.processSchema(schema.items as JSONSchema7);\n }\n\n const unsupportedProps = this.getUnsupportedArrayProperties();\n for (const prop of unsupportedProps) {\n if (prop in processed) {\n delete processed[prop];\n }\n }\n\n if (Object.keys(constraints).length > 0) {\n processed.description = this.mergeDescription(schema.description, constraints);\n }\n\n return processed as JSONSchema7;\n }\n\n protected processObjectSchema(schema: JSONSchema7): JSONSchema7 {\n const constraints: ObjectConstraints = {};\n const processed: Record<string, unknown> = { ...schema };\n\n if (typeof schema.minProperties === \"number\") {\n constraints.minProperties = schema.minProperties;\n }\n if (typeof schema.maxProperties === \"number\") {\n constraints.maxProperties = schema.maxProperties;\n }\n if (typeof schema.additionalProperties === \"boolean\") {\n constraints.additionalProperties = schema.additionalProperties;\n }\n\n if (schema.properties && typeof schema.properties === \"object\") {\n const newProperties: Record<string, JSONSchema7> = {};\n for (const [key, prop] of Object.entries(schema.properties)) {\n if (typeof prop === \"object\" && !Array.isArray(prop)) {\n newProperties[key] = this.processSchema(prop as JSONSchema7);\n } else {\n newProperties[key] = prop as JSONSchema7;\n }\n }\n processed.properties = newProperties;\n }\n\n const unsupportedProps = this.getUnsupportedObjectProperties();\n for (const prop of unsupportedProps) {\n if (prop in processed) {\n delete processed[prop];\n }\n }\n\n if (Object.keys(constraints).length > 0) {\n processed.description = this.mergeDescription(schema.description, constraints);\n }\n\n return processed as JSONSchema7;\n }\n\n protected processGenericSchema(schema: JSONSchema7): JSONSchema7 {\n const processed: Record<string, unknown> = { ...schema };\n\n if (Array.isArray(schema.oneOf)) {\n processed.oneOf = schema.oneOf.map((s) =>\n typeof s === \"object\" ? this.processSchema(s as JSONSchema7) : s\n );\n }\n if (Array.isArray(schema.anyOf)) {\n processed.anyOf = schema.anyOf.map((s) =>\n typeof s === \"object\" ? this.processSchema(s as JSONSchema7) : s\n );\n }\n if (Array.isArray(schema.allOf)) {\n processed.allOf = schema.allOf.map((s) =>\n typeof s === \"object\" ? this.processSchema(s as JSONSchema7) : s\n );\n }\n\n return processed as JSONSchema7;\n }\n\n protected mergeDescription(\n originalDescription: string | undefined,\n constraints: SchemaConstraints\n ): string {\n const constraintJson = JSON.stringify(constraints);\n if (originalDescription) {\n return `${originalDescription}\\n${constraintJson}`;\n }\n return constraintJson;\n }\n\n protected abstract getUnsupportedStringProperties(): readonly string[];\n protected abstract getUnsupportedNumberProperties(): readonly string[];\n protected abstract getUnsupportedArrayProperties(): readonly string[];\n protected abstract getUnsupportedObjectProperties(): readonly string[];\n}\n\ninterface RuntimeWithModel extends IAgentRuntime {\n modelProvider?: string;\n model?: string;\n}\n\nfunction hasModelInfo(runtime: IAgentRuntime): runtime is RuntimeWithModel {\n return (\n typeof runtime === \"object\" &&\n runtime !== null &&\n (\"modelProvider\" in runtime || \"model\" in runtime)\n );\n}\n\nfunction getModelString(runtime: IAgentRuntime): string {\n if (hasModelInfo(runtime)) {\n return runtime.modelProvider ?? runtime.model ?? \"\";\n }\n if (\n runtime.character &&\n typeof runtime.character === \"object\" &&\n \"settings\" in runtime.character &&\n runtime.character.settings &&\n typeof runtime.character.settings === \"object\"\n ) {\n const settings = runtime.character.settings as Record<string, unknown>;\n const modelProvider = settings.MODEL_PROVIDER ?? settings.modelProvider;\n const model = settings.MODEL ?? settings.model;\n return String(modelProvider ?? model ?? \"\");\n }\n return \"\";\n}\n\nexport function detectModelProvider(runtime: IAgentRuntime): ModelInfo {\n const modelString = getModelString(runtime);\n const modelId = String(modelString).toLowerCase();\n\n let provider: ModelProvider = \"openrouter\";\n let supportsStructuredOutputs = false;\n let isReasoningModel = false;\n\n if (\n modelId.includes(\"openai\") ||\n modelId.includes(\"gpt-\") ||\n modelId.includes(\"o1-\") ||\n modelId.includes(\"o3-\")\n ) {\n provider = \"openai\";\n supportsStructuredOutputs =\n modelId.includes(\"gpt-4\") || modelId.includes(\"o1\") || modelId.includes(\"o3\");\n isReasoningModel = modelId.includes(\"o1\") || modelId.includes(\"o3\");\n } else if (modelId.includes(\"anthropic\") || modelId.includes(\"claude\")) {\n provider = \"anthropic\";\n supportsStructuredOutputs = true;\n } else if (modelId.includes(\"google\") || modelId.includes(\"gemini\")) {\n provider = \"google\";\n supportsStructuredOutputs = true;\n } else if (modelId.includes(\"openrouter\")) {\n provider = \"openrouter\";\n supportsStructuredOutputs = false;\n }\n\n return {\n provider,\n modelId,\n supportsStructuredOutputs,\n isReasoningModel,\n };\n}\n",
6
+ "import { McpToolCompatibility, type SchemaConstraints } from \"../base\";\n\ninterface OpenAIConstraints {\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n format?: string;\n pattern?: string;\n enum?: readonly string[];\n minItems?: number;\n maxItems?: number;\n}\n\nexport class OpenAIMcpCompatibility extends McpToolCompatibility {\n shouldApply(): boolean {\n return (\n this.modelInfo.provider === \"openai\" &&\n (!this.modelInfo.supportsStructuredOutputs || this.modelInfo.isReasoningModel === true)\n );\n }\n\n protected getUnsupportedStringProperties(): readonly string[] {\n const baseUnsupported = [\"format\"];\n\n if (this.modelInfo.isReasoningModel === true) {\n return [...baseUnsupported, \"pattern\"];\n }\n\n if (this.modelInfo.modelId.includes(\"gpt-3.5\") || this.modelInfo.modelId.includes(\"davinci\")) {\n return [...baseUnsupported, \"pattern\"];\n }\n\n return baseUnsupported;\n }\n\n protected getUnsupportedNumberProperties(): readonly string[] {\n if (this.modelInfo.isReasoningModel === true) {\n return [\"exclusiveMinimum\", \"exclusiveMaximum\", \"multipleOf\"];\n }\n return [];\n }\n\n protected getUnsupportedArrayProperties(): readonly string[] {\n if (this.modelInfo.isReasoningModel === true) {\n return [\"uniqueItems\"];\n }\n return [];\n }\n\n protected getUnsupportedObjectProperties(): readonly string[] {\n return [\"minProperties\", \"maxProperties\"];\n }\n}\n\nexport class OpenAIReasoningMcpCompatibility extends McpToolCompatibility {\n shouldApply(): boolean {\n return this.modelInfo.provider === \"openai\" && this.modelInfo.isReasoningModel === true;\n }\n\n protected getUnsupportedStringProperties(): readonly string[] {\n return [\"format\", \"pattern\", \"minLength\", \"maxLength\"];\n }\n\n protected getUnsupportedNumberProperties(): readonly string[] {\n return [\"exclusiveMinimum\", \"exclusiveMaximum\", \"multipleOf\"];\n }\n\n protected getUnsupportedArrayProperties(): readonly string[] {\n return [\"uniqueItems\", \"minItems\", \"maxItems\"];\n }\n\n protected getUnsupportedObjectProperties(): readonly string[] {\n return [\"minProperties\", \"maxProperties\", \"additionalProperties\"];\n }\n\n protected mergeDescription(\n originalDescription: string | undefined,\n constraints: SchemaConstraints\n ): string {\n const constraintText = this.formatConstraintsForReasoningModel(\n constraints as OpenAIConstraints\n );\n if (originalDescription) {\n return `${originalDescription}\\n\\nIMPORTANT: ${constraintText}`;\n }\n return `IMPORTANT: ${constraintText}`;\n }\n\n private formatConstraintsForReasoningModel(constraints: OpenAIConstraints): string {\n const rules: string[] = [];\n\n if (constraints.minLength) {\n rules.push(`minimum ${constraints.minLength} characters`);\n }\n if (constraints.maxLength) {\n rules.push(`maximum ${constraints.maxLength} characters`);\n }\n if (constraints.minimum !== undefined) {\n rules.push(`must be >= ${constraints.minimum}`);\n }\n if (constraints.maximum !== undefined) {\n rules.push(`must be <= ${constraints.maximum}`);\n }\n if (constraints.format === \"email\") {\n rules.push(`must be a valid email address`);\n }\n if (constraints.format === \"uri\" || constraints.format === \"url\") {\n rules.push(`must be a valid URL`);\n }\n if (constraints.format === \"uuid\") {\n rules.push(`must be a valid UUID`);\n }\n if (constraints.pattern) {\n rules.push(`must match pattern: ${constraints.pattern}`);\n }\n if (constraints.enum) {\n rules.push(`must be one of: ${constraints.enum.join(\", \")}`);\n }\n if (constraints.minItems) {\n rules.push(`array must have at least ${constraints.minItems} items`);\n }\n if (constraints.maxItems) {\n rules.push(`array must have at most ${constraints.maxItems} items`);\n }\n\n return rules.length > 0 ? rules.join(\", \") : JSON.stringify(constraints);\n }\n}\n",
7
+ "import { McpToolCompatibility, type SchemaConstraints } from \"../base\";\n\ninterface AnthropicConstraints {\n additionalProperties?: boolean;\n format?: string;\n pattern?: string;\n}\n\nexport class AnthropicMcpCompatibility extends McpToolCompatibility {\n shouldApply(): boolean {\n return this.modelInfo.provider === \"anthropic\";\n }\n\n protected getUnsupportedStringProperties(): readonly string[] {\n return [];\n }\n\n protected getUnsupportedNumberProperties(): readonly string[] {\n return [];\n }\n\n protected getUnsupportedArrayProperties(): readonly string[] {\n return [];\n }\n\n protected getUnsupportedObjectProperties(): readonly string[] {\n return [\"additionalProperties\"];\n }\n\n protected mergeDescription(\n originalDescription: string | undefined,\n constraints: SchemaConstraints\n ): string {\n const constraintHints = this.formatConstraintsForAnthropic(constraints as AnthropicConstraints);\n if (originalDescription && constraintHints) {\n return `${originalDescription}. ${constraintHints}`;\n } else if (constraintHints) {\n return constraintHints;\n }\n return originalDescription ?? \"\";\n }\n\n private formatConstraintsForAnthropic(constraints: AnthropicConstraints): string {\n const hints: string[] = [];\n\n if (constraints.additionalProperties === false) {\n hints.push(\"Only use the specified properties\");\n }\n if (constraints.format === \"date-time\") {\n hints.push(\"Use ISO 8601 date-time format\");\n }\n if (constraints.pattern) {\n hints.push(`Must match the pattern: ${constraints.pattern}`);\n }\n\n return hints.join(\". \");\n }\n}\n",
8
+ "import { McpToolCompatibility, type SchemaConstraints } from \"../base\";\n\ninterface GoogleConstraints {\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n exclusiveMinimum?: number;\n exclusiveMaximum?: number;\n multipleOf?: number;\n format?: string;\n pattern?: string;\n enum?: readonly string[];\n minItems?: number;\n maxItems?: number;\n uniqueItems?: boolean;\n minProperties?: number;\n maxProperties?: number;\n additionalProperties?: boolean;\n}\n\nexport class GoogleMcpCompatibility extends McpToolCompatibility {\n shouldApply(): boolean {\n return this.modelInfo.provider === \"google\";\n }\n\n protected getUnsupportedStringProperties(): readonly string[] {\n return [\"minLength\", \"maxLength\", \"pattern\", \"format\"];\n }\n\n protected getUnsupportedNumberProperties(): readonly string[] {\n return [\"minimum\", \"maximum\", \"exclusiveMinimum\", \"exclusiveMaximum\", \"multipleOf\"];\n }\n\n protected getUnsupportedArrayProperties(): readonly string[] {\n return [\"minItems\", \"maxItems\", \"uniqueItems\"];\n }\n\n protected getUnsupportedObjectProperties(): readonly string[] {\n return [\"minProperties\", \"maxProperties\", \"additionalProperties\"];\n }\n\n protected mergeDescription(\n originalDescription: string | undefined,\n constraints: SchemaConstraints\n ): string {\n const constraintText = this.formatConstraintsForGoogle(constraints as GoogleConstraints);\n if (originalDescription && constraintText) {\n return `${originalDescription}\\n\\nConstraints: ${constraintText}`;\n } else if (constraintText) {\n return `Constraints: ${constraintText}`;\n }\n return originalDescription ?? \"\";\n }\n\n private formatConstraintsForGoogle(constraints: GoogleConstraints): string {\n const rules: string[] = [];\n\n if (constraints.minLength) {\n rules.push(`text must be at least ${constraints.minLength} characters long`);\n }\n if (constraints.maxLength) {\n rules.push(`text must be no more than ${constraints.maxLength} characters long`);\n }\n if (constraints.minimum !== undefined) {\n rules.push(`number must be at least ${constraints.minimum}`);\n }\n if (constraints.maximum !== undefined) {\n rules.push(`number must be no more than ${constraints.maximum}`);\n }\n if (constraints.exclusiveMinimum !== undefined) {\n rules.push(`number must be greater than ${constraints.exclusiveMinimum}`);\n }\n if (constraints.exclusiveMaximum !== undefined) {\n rules.push(`number must be less than ${constraints.exclusiveMaximum}`);\n }\n if (constraints.multipleOf) {\n rules.push(`number must be a multiple of ${constraints.multipleOf}`);\n }\n if (constraints.format === \"email\") {\n rules.push(`must be a valid email address`);\n }\n if (constraints.format === \"uri\" || constraints.format === \"url\") {\n rules.push(`must be a valid URL starting with http:// or https://`);\n }\n if (constraints.format === \"uuid\") {\n rules.push(`must be a valid UUID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`);\n }\n if (constraints.format === \"date-time\") {\n rules.push(`must be a valid ISO 8601 date-time (e.g., 2023-12-25T10:30:00Z)`);\n }\n if (constraints.pattern) {\n rules.push(`must match the regular expression pattern: ${constraints.pattern}`);\n }\n if (constraints.enum && Array.isArray(constraints.enum)) {\n rules.push(`must be exactly one of these values: ${constraints.enum.join(\", \")}`);\n }\n if (constraints.minItems) {\n rules.push(`array must contain at least ${constraints.minItems} items`);\n }\n if (constraints.maxItems) {\n rules.push(`array must contain no more than ${constraints.maxItems} items`);\n }\n if (constraints.uniqueItems === true) {\n rules.push(`array items must all be unique (no duplicates)`);\n }\n if (constraints.minProperties) {\n rules.push(`object must have at least ${constraints.minProperties} properties`);\n }\n if (constraints.maxProperties) {\n rules.push(`object must have no more than ${constraints.maxProperties} properties`);\n }\n if (constraints.additionalProperties === false) {\n rules.push(\n `object must only contain the specified properties, no additional properties allowed`\n );\n }\n\n return rules.join(\"; \");\n }\n}\n",
9
+ "import { type IAgentRuntime, logger, type Plugin } from \"@elizaos/core\";\nimport { callToolAction } from \"./actions/callToolAction\";\nimport { readResourceAction } from \"./actions/readResourceAction\";\nimport { provider } from \"./provider\";\nimport { McpService } from \"./service\";\n\nconst mcpPlugin: Plugin = {\n name: \"mcp\",\n description: \"Plugin for connecting to MCP (Model Context Protocol) servers\",\n\n init: async (_config: Record<string, string>, _runtime: IAgentRuntime): Promise<void> => {\n logger.info(\"Initializing MCP plugin...\");\n },\n\n services: [McpService],\n actions: [callToolAction, readResourceAction],\n providers: [provider],\n};\n\nexport default mcpPlugin;\n",
10
+ "import type { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport type { SSEClientTransport } from \"@modelcontextprotocol/sdk/client/sse.js\";\nimport type { StdioClientTransport } from \"@modelcontextprotocol/sdk/client/stdio.js\";\nimport type {\n EmbeddedResource,\n ImageContent,\n Resource,\n ResourceTemplate,\n TextContent,\n Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\n\nexport const MCP_SERVICE_NAME = \"mcp\" as const;\nexport const DEFAULT_MCP_TIMEOUT_SECONDS = 60000;\nexport const MIN_MCP_TIMEOUT_SECONDS = 1;\nexport const DEFAULT_MAX_RETRIES = 2;\n\nexport interface PingConfig {\n readonly enabled: boolean;\n readonly intervalMs: number;\n readonly timeoutMs: number;\n readonly failuresBeforeDisconnect: number;\n}\n\nexport type ConnectionStatus = \"connecting\" | \"connected\" | \"disconnected\" | \"failed\";\n\nexport interface ConnectionState {\n status: ConnectionStatus;\n pingInterval?: ReturnType<typeof setInterval>;\n reconnectTimeout?: ReturnType<typeof setTimeout>;\n reconnectAttempts: number;\n lastConnected?: Date;\n lastError?: Error;\n consecutivePingFailures: number;\n}\n\nexport interface StdioMcpServerConfig {\n readonly type: \"stdio\";\n readonly command: string;\n readonly args?: readonly string[];\n readonly env?: Readonly<Record<string, string>>;\n readonly cwd?: string;\n readonly timeoutInMillis?: number;\n}\n\nexport interface HttpMcpServerConfig {\n readonly type: \"http\" | \"streamable-http\" | \"sse\";\n readonly url: string;\n readonly timeout?: number;\n}\n\nexport type McpServerConfig = StdioMcpServerConfig | HttpMcpServerConfig;\n\nexport interface McpSettings {\n readonly servers: Readonly<Record<string, McpServerConfig>>;\n readonly maxRetries?: number;\n}\n\nexport type McpServerStatus = \"connecting\" | \"connected\" | \"disconnected\";\n\nexport interface McpServer {\n readonly name: string;\n status: McpServerStatus;\n readonly config: string;\n error?: string;\n disabled?: boolean;\n tools?: readonly Tool[];\n resources?: readonly Resource[];\n resourceTemplates?: readonly ResourceTemplate[];\n}\n\nexport interface McpConnection {\n server: McpServer;\n readonly client: Client;\n readonly transport: StdioClientTransport | SSEClientTransport;\n}\n\nexport interface McpToolResult {\n readonly content: ReadonlyArray<TextContent | ImageContent | EmbeddedResource>;\n readonly isError?: boolean;\n}\n\nexport interface McpResourceContent {\n readonly uri: string;\n readonly mimeType?: string;\n readonly text?: string;\n readonly blob?: string;\n}\n\nexport interface McpResourceResponse {\n readonly contents: readonly McpResourceContent[];\n}\n\nexport interface McpToolInputSchema {\n readonly properties?: Readonly<Record<string, JsonSchemaProperty>>;\n readonly required?: readonly string[];\n readonly [key: string]:\n | JsonSchemaValue\n | Readonly<Record<string, JsonSchemaProperty>>\n | readonly string[]\n | undefined;\n}\n\nexport interface McpToolInfo {\n readonly description: string;\n readonly inputSchema?: McpToolInputSchema;\n}\n\nexport interface McpResourceInfo {\n readonly name: string;\n readonly description: string;\n readonly mimeType?: string;\n}\n\nexport interface McpServerInfo {\n readonly status: string;\n readonly tools: Readonly<Record<string, McpToolInfo>>;\n readonly resources: Readonly<Record<string, McpResourceInfo>>;\n}\n\nexport interface McpProviderData {\n readonly [serverName: string]: McpServerInfo;\n}\n\nexport interface McpProviderValues {\n readonly mcp: McpProviderData;\n readonly mcpText?: string;\n}\n\nexport interface McpProvider {\n readonly values: McpProviderValues;\n readonly data: { readonly mcp: McpProviderData };\n readonly text: string;\n}\n\nexport type JsonSchemaPrimitive = string | number | boolean | null;\nexport type JsonSchemaValue = JsonSchemaPrimitive | JsonSchemaObject | JsonSchemaArray;\nexport interface JsonSchemaObject {\n readonly [key: string]: JsonSchemaValue;\n}\nexport type JsonSchemaArray = readonly JsonSchemaValue[];\n\nexport interface JsonSchemaProperty {\n readonly type?: string;\n readonly description?: string;\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly pattern?: string;\n readonly format?: string;\n readonly enum?: readonly string[];\n readonly minimum?: number;\n readonly maximum?: number;\n readonly items?: JsonSchemaProperty;\n readonly properties?: Readonly<Record<string, JsonSchemaProperty>>;\n readonly required?: readonly string[];\n readonly [key: string]:\n | JsonSchemaValue\n | JsonSchemaProperty\n | Readonly<Record<string, JsonSchemaProperty>>\n | readonly string[]\n | undefined;\n}\n\nexport const ToolSelectionSchema = {\n type: \"object\",\n required: [\"serverName\", \"toolName\", \"arguments\"],\n properties: {\n serverName: {\n type: \"string\",\n minLength: 1,\n errorMessage: \"serverName must not be empty\",\n },\n toolName: {\n type: \"string\",\n minLength: 1,\n errorMessage: \"toolName must not be empty\",\n },\n arguments: {\n type: \"object\",\n },\n reasoning: {\n type: \"string\",\n },\n noToolAvailable: {\n type: \"boolean\",\n },\n },\n} as const;\n\nexport const ResourceSelectionSchema = {\n type: \"object\",\n required: [\"serverName\", \"uri\"],\n properties: {\n serverName: {\n type: \"string\",\n minLength: 1,\n errorMessage: \"serverName must not be empty\",\n },\n uri: {\n type: \"string\",\n minLength: 1,\n errorMessage: \"uri must not be empty\",\n },\n reasoning: {\n type: \"string\",\n },\n noResourceAvailable: {\n type: \"boolean\",\n },\n },\n} as const;\n\nexport const DEFAULT_PING_CONFIG: Readonly<PingConfig> = {\n enabled: true,\n intervalMs: 10000,\n timeoutMs: 5000,\n failuresBeforeDisconnect: 3,\n} as const;\n\nexport const MAX_RECONNECT_ATTEMPTS = 5;\nexport const BACKOFF_MULTIPLIER = 2;\nexport const INITIAL_RETRY_DELAY = 2000;\n\ninterface SuccessResult<T> {\n readonly success: true;\n readonly data: T;\n}\n\ninterface ErrorResult {\n readonly success: false;\n readonly error: string;\n}\n\nexport type ValidationResult<T> = SuccessResult<T> | ErrorResult;\n\nexport function assertNonNull<T>(value: T | null | undefined, message: string): T {\n if (value === null || value === undefined) {\n throw new Error(message);\n }\n return value;\n}\n\nexport function assertString(value: unknown, message: string): string {\n if (typeof value !== \"string\") {\n throw new Error(message);\n }\n return value;\n}\n\nexport function assertNonEmptyString(value: unknown, message: string): string {\n if (typeof value !== \"string\" || value.length === 0) {\n throw new Error(message);\n }\n return value;\n}\n\nexport function assertObject(value: unknown, message: string): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(message);\n }\n return value as Record<string, unknown>;\n}\n",
11
+ "import type { State } from \"@elizaos/core\";\nimport {\n type ActionResult,\n composePromptFromState,\n type HandlerCallback,\n type IAgentRuntime,\n logger,\n type Memory,\n ModelType,\n} from \"@elizaos/core\";\nimport { errorAnalysisPrompt } from \"../templates/errorAnalysisPrompt\";\nimport type { McpProvider } from \"../types\";\n\nexport async function handleMcpError(\n state: State,\n mcpProvider: McpProvider,\n error: unknown,\n runtime: IAgentRuntime,\n message: Memory,\n type: \"tool\" | \"resource\",\n callback?: HandlerCallback\n): Promise<ActionResult> {\n const errorMessage = error instanceof Error ? error.message : String(error);\n\n logger.error({ error, mcpType: type }, `Error executing MCP ${type}: ${errorMessage}`);\n\n let responseText = `I'm sorry, I wasn't able to get the information you requested. There seems to be an issue with the ${type} right now. Is there something else I can help you with?`;\n\n if (callback) {\n const enhancedState: State = {\n ...state,\n values: {\n ...state.values,\n mcpProvider,\n userMessage: message.content.text ?? \"\",\n error: errorMessage,\n },\n };\n\n const prompt = composePromptFromState({\n state: enhancedState,\n template: errorAnalysisPrompt,\n });\n\n const errorResponse = (await runtime.useModel(ModelType.TEXT_SMALL, {\n prompt,\n })) as string;\n\n responseText = errorResponse;\n\n await callback({\n text: responseText,\n actions: [\"REPLY\"],\n });\n }\n\n return {\n text: `Failed to execute MCP ${type}`,\n values: {\n success: false,\n error: errorMessage,\n errorType: type,\n },\n data: {\n actionName: type === \"tool\" ? \"CALL_MCP_TOOL\" : \"READ_MCP_RESOURCE\",\n error: errorMessage,\n mcpType: type,\n },\n success: false,\n error: error instanceof Error ? error : new Error(errorMessage),\n };\n}\n\nexport class McpError extends Error {\n readonly code: string;\n\n constructor(message: string, code: string = \"UNKNOWN\") {\n super(message);\n this.name = \"McpError\";\n this.code = code;\n }\n\n static connectionError(serverName: string, details?: string): McpError {\n return new McpError(\n `Failed to connect to server '${serverName}'${details ? `: ${details}` : \"\"}`,\n \"CONNECTION_ERROR\"\n );\n }\n\n static toolNotFound(toolName: string, serverName: string): McpError {\n return new McpError(`Tool '${toolName}' not found on server '${serverName}'`, \"TOOL_NOT_FOUND\");\n }\n\n static resourceNotFound(uri: string, serverName: string): McpError {\n return new McpError(\n `Resource '${uri}' not found on server '${serverName}'`,\n \"RESOURCE_NOT_FOUND\"\n );\n }\n\n static validationError(details: string): McpError {\n return new McpError(`Validation error: ${details}`, \"VALIDATION_ERROR\");\n }\n\n static serverError(serverName: string, details?: string): McpError {\n return new McpError(\n `Server error from '${serverName}'${details ? `: ${details}` : \"\"}`,\n \"SERVER_ERROR\"\n );\n }\n}\n",
12
+ "/**\n * Auto-generated prompt templates\n * DO NOT EDIT - Generated from ../../../../../prompts/*.txt\n *\n * These prompts use Handlebars-style template syntax:\n * - {{variableName}} for simple substitution\n * - {{#each items}}...{{/each}} for iteration\n * - {{#if condition}}...{{/if}} for conditionals\n */\n\nexport const errorAnalysisTemplate = `{{{mcpProvider.text}}}\n\n{{{recentMessages}}}\n\n# Prompt\n\nYou're an assistant helping a user, but there was an error accessing the resource you tried to use.\n\nUser request: \"{{{userMessage}}}\"\nError message: {{{error}}}\n\nCreate a helpful response that:\n1. Acknowledges the issue in user-friendly terms\n2. Offers alternative approaches to help if possible\n3. Doesn't expose technical error details unless they're truly helpful\n4. Maintains a helpful, conversational tone\n\nYour response:`;\n\nexport const ERROR_ANALYSIS_TEMPLATE = errorAnalysisTemplate;\n\nexport const feedbackTemplate = `{{{mcpProvider.text}}}\n\n{{{recentMessages}}}\n\n# Prompt\n\nYou previously attempted to parse a JSON selection but encountered an error. You need to fix the issues and provide a valid JSON response.\n\nPREVIOUS RESPONSE:\n{{{originalResponse}}\n\nERROR:\n{{{errorMessage}}\n\nAvailable {{{itemType}}}s:\n{{{itemsDescription}}\n\nUser request: \"{{{userMessage}}}\"\n\nCORRECTED INSTRUCTIONS:\n1. Create a valid JSON object that selects the most appropriate {{{itemType}}} for the task\n2. Make sure to use proper JSON syntax with double quotes for keys and string values\n3. Ensure all values exactly match the available {{{itemType}}}s (names are case-sensitive!)\n4. Do not include any markdown formatting, explanations, or non-JSON content\n5. Do not use placeholders - all values should be concrete and usable\n\nYOUR CORRECTED VALID JSON RESPONSE:`;\n\nexport const FEEDBACK_TEMPLATE = feedbackTemplate;\n\nexport const resourceAnalysisTemplate = `{{{mcpProvider.text}}}\n\n{{{recentMessages}}}\n\n# Prompt\n\nYou are a helpful assistant responding to a user's request. You've just accessed the resource \"{{{uri}}}\" to help answer this request.\n\nOriginal user request: \"{{{userMessage}}}\"\n\nResource metadata: \n{{{resourceMeta}}\n\nResource content: \n{{{resourceContent}}\n\nInstructions:\n1. Analyze how well the resource's content addresses the user's specific question or need\n2. Identify the most relevant information from the resource\n3. Create a natural, conversational response that incorporates this information\n4. If the resource content is insufficient, acknowledge its limitations and explain what you can determine\n5. Do not start with phrases like \"According to the resource\" or \"Here's what I found\" - instead, integrate the information naturally\n6. Maintain your helpful, intelligent assistant personality while presenting the information\n\nYour response (written as if directly to the user):`;\n\nexport const RESOURCE_ANALYSIS_TEMPLATE = resourceAnalysisTemplate;\n\nexport const resourceSelectionTemplate = `{{{mcpProvider.text}}}\n\n{{{recentMessages}}}\n\n# Prompt\n\nYou are an intelligent assistant helping select the right resource to address a user's request.\n\nCRITICAL INSTRUCTIONS:\n1. You MUST specify both a valid serverName AND uri from the list above\n2. The serverName value should match EXACTLY the server name shown in parentheses (Server: X)\n CORRECT: \"serverName\": \"github\" (if the server is called \"github\") \n WRONG: \"serverName\": \"GitHub\" or \"Github\" or any other variation\n3. The uri value should match EXACTLY the resource uri listed\n CORRECT: \"uri\": \"weather://San Francisco/current\" (if that's the exact uri)\n WRONG: \"uri\": \"weather://sanfrancisco/current\" or any variation\n4. Identify the user's information need from the conversation context\n5. Select the most appropriate resource based on its description and the request\n6. If no resource seems appropriate, output {\"noResourceAvailable\": true}\n\n!!! YOUR RESPONSE MUST BE A VALID JSON OBJECT ONLY !!! \n\nSTRICT FORMAT REQUIREMENTS:\n- NO code block formatting (NO backticks or \\`\\`\\`)\n- NO comments (NO // or /* */)\n- NO placeholders like \"replace with...\", \"example\", \"your...\", \"actual\", etc.\n- Every parameter value must be a concrete, usable value (not instructions to replace)\n- Use proper JSON syntax with double quotes for strings\n- NO explanatory text before or after the JSON object\n\nEXAMPLE RESPONSE:\n{\n \"serverName\": \"weather-server\",\n \"uri\": \"weather://San Francisco/current\",\n \"reasoning\": \"Based on the conversation, the user is asking about current weather in San Francisco. This resource provides up-to-date weather information for that city.\"\n}\n\nREMEMBER: Your response will be parsed directly as JSON. If it fails to parse, the operation will fail completely!`;\n\nexport const RESOURCE_SELECTION_TEMPLATE = resourceSelectionTemplate;\n\nexport const toolReasoningTemplate = `{{{mcpProvider.text}}}\n\n{{{recentMessages}}}\n\n# Prompt\n\nYou are a helpful assistant responding to a user's request. You've just used the \"{{{toolName}}}\" tool from the \"{{{serverName}}}\" server to help answer this request.\n\nOriginal user request: \"{{{userMessage}}}\"\n\nTool response:\n{{{toolOutput}}}\n\n{{#if hasAttachments}}\nThe tool also returned images or other media that will be shared with the user.\n{{/if}}\n\nInstructions:\n1. Analyze how well the tool's response addresses the user's specific question or need\n2. Identify the most relevant information from the tool's output\n3. Create a natural, conversational response that incorporates this information\n4. If the tool's response is insufficient, acknowledge its limitations and explain what you can determine\n5. Do not start with phrases like \"I used the X tool\" or \"Here's what I found\" - instead, integrate the information naturally\n6. Maintain your helpful, intelligent assistant personality while presenting the information\n\nYour response (written as if directly to the user):`;\n\nexport const TOOL_REASONING_TEMPLATE = toolReasoningTemplate;\n\nexport const toolSelectionArgumentTemplate = `{{recentMessages}}\n\n# TASK: Generate a Strictly Valid JSON Object for Tool Execution\n\nYou have chosen the \"{{toolSelectionName.toolName}}\" tool from the \"{{toolSelectionName.serverName}}\" server to address the user's request.\nThe reasoning behind this selection is: \"{{toolSelectionName.reasoning}}\"\n\n## CRITICAL INSTRUCTIONS\n1. Ensure the \"toolArguments\" object strictly adheres to the structure and requirements defined in the schema.\n2. All parameter values must be extracted from the conversation context and must be concrete, usable values.\n3. Avoid placeholders or generic terms unless explicitly provided by the user.\n\n!!! YOUR RESPONSE MUST BE A VALID JSON OBJECT ONLY !!! \n\n## STRICT FORMAT REQUIREMENTS\n- The response MUST be a single valid JSON object.\n- DO NOT wrap the JSON in triple backticks (\\`\\`\\`), code blocks, or include any explanatory text.\n- DO NOT include comments (// or /* */) anywhere.\n- DO NOT use placeholders (e.g., \"replace with...\", \"example\", \"your...\", etc.)\n- ALL strings must use double quotes\n\n## CRITICAL NOTES\n- All values must be fully grounded in user input or inferred contextually.\n- No missing fields unless they are explicitly optional in the schema.\n- All types must match the schema (strings, numbers, booleans).\n\n## JSON OBJECT STRUCTURE\nYour response MUST contain ONLY these two top-level keys:\n1. \"toolArguments\" — An object matching the input schema: {{toolInputSchema}}\n2. \"reasoning\" — A string explaining how the values were inferred from the conversation.\n\n## EXAMPLE RESPONSE\n{\n \"toolArguments\": {\n \"owner\": \"facebook\",\n \"repo\": \"react\",\n \"path\": \"README.md\",\n \"branch\": \"main\"\n },\n \"reasoning\": \"The user wants to see the README from the facebook/react repository based on our conversation.\"\n}\n\nREMEMBER: Your response will be parsed directly as JSON. If it fails to parse, the operation will fail completely.`;\n\nexport const TOOL_SELECTION_ARGUMENT_TEMPLATE = toolSelectionArgumentTemplate;\n\nexport const toolSelectionNameTemplate = `{{mcpProvider.text}}\n\n{{recentMessages}}\n\n# TASK: Select the Most Appropriate Tool and Server\n\nYou must select the most appropriate tool from the list above to fulfill the user's request. Your response must be a valid JSON object with the required properties.\n\n## CRITICAL INSTRUCTIONS\n1. Provide both \"serverName\" and \"toolName\" from the options listed above.\n2. Each name must match EXACTLY as shown in the list:\n - Example (correct): \"serverName\": \"github\"\n - Example (incorrect): \"serverName\": \"GitHub\", \"Github\", or variations\n3. Extract ACTUAL parameter values from the conversation context.\n - Do not invent or use placeholders like \"octocat\" or \"Hello-World\" unless the user said so.\n4. Include a \"reasoning\" field explaining why the selected tool fits the request.\n5. If no tool is appropriate, respond with:\n {\n \"noToolAvailable\": true\n }\n\n!!! YOUR RESPONSE MUST BE A VALID JSON OBJECT ONLY !!! \n\nCRITICAL: Your response must START with { and END with }. DO NOT include ANY text before or after the JSON.\n\n## STRICT FORMAT REQUIREMENTS\n- The response MUST be a single valid JSON object.\n- DO NOT wrap the JSON in triple backticks (\\`\\`\\`), code blocks, or include any explanatory text.\n- DO NOT include comments (// or /* */) anywhere.\n- DO NOT use placeholders (e.g., \"replace with...\", \"example\", \"your...\", etc.)\n- ALL strings must use double quotes.\n\n## CRITICAL NOTES\n- All values must be fully grounded in user input or inferred contextually.\n- No missing fields unless they are explicitly optional in the schema.\n- All types must match the schema (strings, numbers, booleans).\n\n## JSON OBJECT STRUCTURE\nYour response MUST contain ONLY these top-level keys:\n1. \"serverName\" — The name of the server (e.g., \"github\", \"notion\")\n2. \"toolName\" — The name of the tool (e.g., \"get_file_contents\", \"search\")\n3. \"reasoning\" — A string explaining how the values were inferred from the conversation.\n4. \"noToolAvailable\" — A boolean indicating if no tool is available (true/false)\n\n## EXAMPLE RESPONSE\n{\n \"serverName\": \"github\",\n \"toolName\": \"get_file_contents\",\n \"reasoning\": \"The user wants to retrieve the README from the facebook/react repository.\",\n \"noToolAvailable\": false\n}\n\n## REMINDERS\n- Use \"github\" as serverName for GitHub tools.\n- Use \"notion\" as serverName for Notion tools.\n- For search and knowledge-based tasks, MCP tools are often appropriate.\n\nREMEMBER: This output will be parsed directly as JSON. If the format is incorrect, the operation will fail.`;\n\nexport const TOOL_SELECTION_NAME_TEMPLATE = toolSelectionNameTemplate;\n",
13
+ "/**\n * Error analysis prompt for MCP plugin.\n * Auto-generated from prompts/error_analysis.txt\n * DO NOT EDIT - Generated from ../generated/prompts/typescript/prompts.ts\n */\nimport { errorAnalysisTemplate } from \"../generated/prompts/typescript/prompts.js\";\n\nexport const errorAnalysisPrompt = errorAnalysisTemplate;\n",
14
+ "import type { ActionResult, HandlerCallback } from \"@elizaos/core\";\n\ninterface ToolSelectionResult {\n readonly noToolAvailable?: boolean;\n readonly reasoning?: string;\n}\n\nexport async function handleNoToolAvailable(\n callback: HandlerCallback | undefined,\n toolSelection: ToolSelectionResult | null | undefined\n): Promise<ActionResult> {\n const responseText =\n \"I don't have a specific tool that can help with that request. Let me try to assist you directly instead.\";\n\n if (callback && toolSelection?.noToolAvailable) {\n await callback({\n text: responseText,\n actions: [\"REPLY\"],\n });\n }\n\n return {\n text: responseText,\n values: {\n success: true,\n noToolAvailable: true,\n fallbackToDirectAssistance: true,\n },\n data: {\n actionName: \"CALL_MCP_TOOL\",\n noToolAvailable: true,\n reason: toolSelection?.reasoning ?? \"No appropriate tool available\",\n },\n success: true,\n };\n}\n",
15
+ "import {\n type Content,\n ContentType,\n composePromptFromState,\n createUniqueUuid,\n type HandlerCallback,\n type IAgentRuntime,\n type Media,\n type Memory,\n ModelType,\n type State,\n} from \"@elizaos/core\";\nimport { resourceAnalysisTemplate } from \"../templates/resourceAnalysisTemplate\";\nimport { toolReasoningTemplate } from \"../templates/toolReasoningTemplate\";\nimport type { McpProviderData, McpResourceContent } from \"../types\";\nimport { createMcpMemory } from \"./mcp\";\n\nfunction getMimeTypeToContentType(mimeType: string | undefined): ContentType | undefined {\n if (!mimeType) return undefined;\n\n if (mimeType.startsWith(\"image/\")) return ContentType.IMAGE;\n if (mimeType.startsWith(\"video/\")) return ContentType.VIDEO;\n if (mimeType.startsWith(\"audio/\")) return ContentType.AUDIO;\n if (mimeType.includes(\"pdf\") || mimeType.includes(\"document\")) return ContentType.DOCUMENT;\n\n return undefined;\n}\n\ninterface ResourceResult {\n readonly contents: readonly McpResourceContent[];\n}\n\nexport function processResourceResult(\n result: ResourceResult,\n uri: string\n): { resourceContent: string; resourceMeta: string } {\n let resourceContent = \"\";\n let resourceMeta = \"\";\n\n for (const content of result.contents) {\n if (content.text) {\n resourceContent += content.text;\n } else if (content.blob) {\n resourceContent += `[Binary data${content.mimeType ? ` - ${content.mimeType}` : \"\"}]`;\n }\n\n resourceMeta += `Resource: ${content.uri ?? uri}\\n`;\n if (content.mimeType) {\n resourceMeta += `Type: ${content.mimeType}\\n`;\n }\n }\n\n return { resourceContent, resourceMeta };\n}\n\ninterface ToolContentItem {\n readonly type: string;\n readonly text?: string;\n readonly mimeType?: string;\n readonly data?: string;\n readonly resource?: {\n readonly uri: string;\n readonly text?: string;\n readonly blob?: string;\n };\n}\n\ninterface ToolResult {\n readonly content: readonly ToolContentItem[];\n readonly isError?: boolean;\n}\n\nexport function processToolResult(\n result: ToolResult,\n serverName: string,\n toolName: string,\n runtime: IAgentRuntime,\n messageEntityId: string\n): { toolOutput: string; hasAttachments: boolean; attachments: Media[] } {\n let toolOutput = \"\";\n let hasAttachments = false;\n const attachments: Media[] = [];\n\n for (const content of result.content) {\n if (content.type === \"text\" && content.text) {\n toolOutput += content.text;\n } else if (content.type === \"image\" && content.data && content.mimeType) {\n hasAttachments = true;\n attachments.push({\n contentType: getMimeTypeToContentType(content.mimeType),\n url: `data:${content.mimeType};base64,${content.data}`,\n id: createUniqueUuid(runtime, messageEntityId),\n title: \"Generated image\",\n source: `${serverName}/${toolName}`,\n description: \"Tool-generated image\",\n text: \"Generated image\",\n });\n } else if (content.type === \"resource\" && content.resource) {\n const resource = content.resource;\n if (\"text\" in resource && resource.text) {\n toolOutput += `\\n\\nResource (${resource.uri}):\\n${resource.text}`;\n } else if (\"blob\" in resource) {\n toolOutput += `\\n\\nResource (${resource.uri}): [Binary data]`;\n }\n }\n }\n\n return { toolOutput, hasAttachments, attachments };\n}\n\nexport async function handleResourceAnalysis(\n runtime: IAgentRuntime,\n message: Memory,\n uri: string,\n serverName: string,\n resourceContent: string,\n resourceMeta: string,\n callback?: HandlerCallback\n): Promise<void> {\n await createMcpMemory(runtime, message, \"resource\", serverName, resourceContent, {\n uri,\n isResourceAccess: true,\n });\n\n const analysisPrompt = createAnalysisPrompt(\n uri,\n message.content.text ?? \"\",\n resourceContent,\n resourceMeta\n );\n\n const analyzedResponse = (await runtime.useModel(ModelType.TEXT_SMALL, {\n prompt: analysisPrompt,\n })) as string;\n\n if (callback) {\n await callback({\n text: analyzedResponse,\n actions: [\"READ_MCP_RESOURCE\"],\n });\n }\n}\n\ninterface McpProviderArg {\n readonly values: { readonly mcp: McpProviderData };\n readonly data: { readonly mcp: McpProviderData };\n readonly text: string;\n}\n\nexport async function handleToolResponse(\n runtime: IAgentRuntime,\n message: Memory,\n serverName: string,\n toolName: string,\n toolArgs: Readonly<Record<string, unknown>>,\n toolOutput: string,\n hasAttachments: boolean,\n attachments: readonly Media[],\n state: State,\n mcpProvider: McpProviderArg,\n callback?: HandlerCallback\n): Promise<Memory> {\n await createMcpMemory(runtime, message, \"tool\", serverName, toolOutput, {\n toolName,\n arguments: toolArgs,\n isToolCall: true,\n });\n\n const reasoningPrompt = createReasoningPrompt(\n state,\n mcpProvider,\n toolName,\n serverName,\n message.content.text ?? \"\",\n toolOutput,\n hasAttachments\n );\n\n const reasonedResponse = (await runtime.useModel(ModelType.TEXT_SMALL, {\n prompt: reasoningPrompt,\n })) as string;\n\n const agentId = message.agentId ?? runtime.agentId;\n const replyMemory: Memory = {\n entityId: agentId,\n roomId: message.roomId,\n worldId: message.worldId,\n content: {\n text: reasonedResponse,\n actions: [\"CALL_MCP_TOOL\"],\n attachments: hasAttachments && attachments.length > 0 ? [...attachments] : undefined,\n },\n };\n\n await runtime.createMemory(replyMemory, \"messages\");\n\n if (callback) {\n await callback({\n text: reasonedResponse,\n actions: [\"CALL_MCP_TOOL\"],\n attachments: hasAttachments && attachments.length > 0 ? [...attachments] : undefined,\n });\n }\n\n return replyMemory;\n}\n\nexport async function sendInitialResponse(callback?: HandlerCallback): Promise<void> {\n if (callback) {\n const responseContent: Content = {\n text: \"I'll retrieve that information for you. Let me access the resource...\",\n actions: [\"READ_MCP_RESOURCE\"],\n };\n await callback(responseContent);\n }\n}\n\nfunction createAnalysisPrompt(\n uri: string,\n userMessage: string,\n resourceContent: string,\n resourceMeta: string\n): string {\n const enhancedState: State = {\n data: {},\n text: \"\",\n values: {\n uri,\n userMessage,\n resourceContent,\n resourceMeta,\n },\n };\n\n return composePromptFromState({\n state: enhancedState,\n template: resourceAnalysisTemplate,\n });\n}\n\nfunction createReasoningPrompt(\n state: State,\n mcpProvider: McpProviderArg,\n toolName: string,\n serverName: string,\n userMessage: string,\n toolOutput: string,\n hasAttachments: boolean\n): string {\n const enhancedState: State = {\n ...state,\n values: {\n ...state.values,\n mcpProvider,\n toolName,\n serverName,\n userMessage,\n toolOutput,\n hasAttachments,\n },\n };\n\n return composePromptFromState({\n state: enhancedState,\n template: toolReasoningTemplate,\n });\n}\n",
16
+ "import type { IAgentRuntime, Memory } from \"@elizaos/core\";\nimport type {\n McpProvider,\n McpProviderData,\n McpResourceInfo,\n McpServer,\n McpToolInfo,\n McpToolInputSchema,\n} from \"../types\";\n\nexport async function createMcpMemory(\n runtime: IAgentRuntime,\n message: Memory,\n type: \"tool\" | \"resource\",\n serverName: string,\n content: string,\n metadata: Readonly<Record<string, unknown>>\n): Promise<void> {\n const memory = await runtime.addEmbeddingToMemory({\n entityId: message.entityId,\n agentId: runtime.agentId,\n roomId: message.roomId,\n content: {\n text: `Used the \"${type}\" from \"${serverName}\" server. \n Content: ${content}`,\n metadata: {\n ...metadata,\n serverName,\n },\n },\n });\n\n await runtime.createMemory(memory, type === \"resource\" ? \"resources\" : \"tools\", true);\n}\n\nexport function buildMcpProviderData(servers: readonly McpServer[]): McpProvider {\n const mcpData: Record<string, McpProviderData[string]> = {};\n let textContent = \"\";\n\n if (servers.length === 0) {\n return {\n values: { mcp: {} },\n data: { mcp: {} },\n text: \"No MCP servers are currently connected.\",\n };\n }\n\n for (const server of servers) {\n const tools: Record<string, McpToolInfo> = {};\n const resources: Record<string, McpResourceInfo> = {};\n\n mcpData[server.name] = {\n status: server.status,\n tools,\n resources,\n };\n\n textContent += `## Server: ${server.name} (${server.status})\\n\\n`;\n\n if (server.tools && server.tools.length > 0) {\n textContent += \"### Tools:\\n\\n\";\n\n for (const tool of server.tools) {\n tools[tool.name] = {\n description: tool.description ?? \"No description available\",\n inputSchema: tool.inputSchema as McpToolInputSchema | undefined,\n };\n\n textContent += `- **${tool.name}**: ${tool.description ?? \"No description available\"}\\n`;\n }\n textContent += \"\\n\";\n }\n\n if (server.resources && server.resources.length > 0) {\n textContent += \"### Resources:\\n\\n\";\n\n for (const resource of server.resources) {\n resources[resource.uri] = {\n name: resource.name,\n description: resource.description ?? \"No description available\",\n mimeType: resource.mimeType,\n };\n\n textContent += `- **${resource.name}** (${resource.uri}): ${\n resource.description ?? \"No description available\"\n }\\n`;\n }\n textContent += \"\\n\";\n }\n }\n\n return {\n values: { mcp: mcpData, mcpText: `# MCP Configuration\\n\\n${textContent}` },\n data: { mcp: mcpData },\n text: `# MCP Configuration\\n\\n${textContent}`,\n };\n}\n",
17
+ "import {\n composePromptFromState,\n type HandlerCallback,\n type IAgentRuntime,\n type Memory,\n ModelType,\n type State,\n} from \"@elizaos/core\";\nimport {\n toolSelectionArgumentTemplate,\n toolSelectionNameTemplate,\n} from \"../templates/toolSelectionTemplate\";\nimport type { McpProvider } from \"../types\";\nimport type { ToolSelectionArgument, ToolSelectionName } from \"./schemas\";\nimport {\n createToolSelectionFeedbackPrompt,\n validateToolSelectionArgument,\n validateToolSelectionName,\n} from \"./validation\";\nimport { withModelRetry } from \"./wrapper\";\n\nexport interface CreateToolSelectionOptions {\n readonly runtime: IAgentRuntime;\n readonly state: State;\n readonly message: Memory;\n readonly callback?: HandlerCallback;\n readonly mcpProvider: McpProvider;\n readonly toolSelectionName?: ToolSelectionName;\n}\n\nexport async function createToolSelectionName({\n runtime,\n state,\n message,\n callback,\n mcpProvider,\n}: CreateToolSelectionOptions): Promise<ToolSelectionName | null> {\n const toolSelectionPrompt: string = composePromptFromState({\n state: { ...state, values: { ...state.values, mcpProvider } },\n template: toolSelectionNameTemplate,\n });\n\n const toolSelectionName = (await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: toolSelectionPrompt,\n })) as string;\n\n return await withModelRetry<ToolSelectionName>({\n runtime,\n message,\n state,\n callback,\n input: toolSelectionName,\n validationFn: (parsed) => validateToolSelectionName(parsed, state),\n createFeedbackPromptFn: (originalResponse, errorMessage, composedState, userMessage) =>\n createToolSelectionFeedbackPrompt(\n typeof originalResponse === \"string\" ? originalResponse : JSON.stringify(originalResponse),\n errorMessage,\n composedState,\n userMessage\n ),\n failureMsg: \"I'm having trouble figuring out the best way to help with your request.\",\n });\n}\n\nexport async function createToolSelectionArgument({\n runtime,\n state,\n message,\n callback,\n mcpProvider,\n toolSelectionName,\n}: CreateToolSelectionOptions): Promise<ToolSelectionArgument | null> {\n if (!toolSelectionName) {\n throw new Error(\"Tool selection name is required to create tool selection argument\");\n }\n\n const { serverName, toolName } = toolSelectionName;\n const serverData = mcpProvider.data.mcp[serverName];\n\n if (!serverData) {\n throw new Error(`Server \"${serverName}\" not found in MCP provider data`);\n }\n\n const toolData = serverData.tools[toolName];\n if (!toolData) {\n throw new Error(`Tool \"${toolName}\" not found on server \"${serverName}\"`);\n }\n\n const toolInputSchema = toolData.inputSchema ?? {};\n\n const toolSelectionArgumentPrompt: string = composePromptFromState({\n state: {\n ...state,\n values: {\n ...state.values,\n toolSelectionName,\n toolInputSchema: JSON.stringify(toolInputSchema),\n },\n },\n template: toolSelectionArgumentTemplate,\n });\n\n const toolSelectionArgument = (await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: toolSelectionArgumentPrompt,\n })) as string;\n\n return await withModelRetry<ToolSelectionArgument>({\n runtime,\n message,\n state,\n callback,\n input: toolSelectionArgument,\n validationFn: (parsed) => validateToolSelectionArgument(parsed, toolInputSchema),\n createFeedbackPromptFn: (originalResponse, errorMessage, composedState, userMessage) =>\n createToolSelectionFeedbackPrompt(\n typeof originalResponse === \"string\" ? originalResponse : JSON.stringify(originalResponse),\n errorMessage,\n composedState,\n userMessage\n ),\n failureMsg: \"I'm having trouble figuring out the best way to help with your request.\",\n });\n}\n",
18
+ "import Ajv from \"ajv\";\nimport JSON5 from \"json5\";\n\nexport function parseJSON<T>(input: string): T {\n let cleanedInput = input.replace(/^```(?:json)?\\s*|\\s*```$/g, \"\").trim();\n\n const firstBrace = cleanedInput.indexOf(\"{\");\n const lastBrace = cleanedInput.lastIndexOf(\"}\");\n\n if (firstBrace === -1 || lastBrace === -1 || lastBrace <= firstBrace) {\n throw new Error(\"No valid JSON object found in input\");\n }\n\n cleanedInput = cleanedInput.substring(firstBrace, lastBrace + 1);\n\n return JSON5.parse(cleanedInput) as T;\n}\n\nconst ajv = new Ajv({\n allErrors: true,\n strict: false,\n});\n\ninterface AjvError {\n readonly instancePath: string;\n readonly message?: string;\n}\n\nfunction formatAjvErrors(errors: readonly AjvError[]): string {\n return errors\n .map((err) => {\n const path = err.instancePath ? `${err.instancePath.replace(/^\\//, \"\")}` : \"value\";\n return `${path}: ${err.message ?? \"validation failed\"}`;\n })\n .join(\", \");\n}\n\nexport function validateJsonSchema<T>(\n data: unknown,\n schema: Readonly<Record<string, unknown>>\n): { success: true; data: T } | { success: false; error: string } {\n const validate = ajv.compile(schema);\n const valid = validate(data);\n\n if (!valid) {\n const errors = validate.errors ?? [];\n const errorMessage = formatAjvErrors(errors as readonly AjvError[]);\n return { success: false, error: errorMessage };\n }\n\n return { success: true, data: data as T };\n}\n\nexport function stringifyJSON(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport function assertJsonObject(value: unknown, context: string): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(`${context}: Expected a JSON object, got ${typeof value}`);\n }\n return value as Record<string, unknown>;\n}\n",
19
+ "export const toolSelectionNameSchema = {\n type: \"object\",\n required: [\"serverName\", \"toolName\"],\n properties: {\n serverName: {\n type: \"string\",\n minLength: 1,\n errorMessage: \"serverName must not be empty\",\n },\n toolName: {\n type: \"string\",\n minLength: 1,\n errorMessage: \"toolName must not be empty\",\n },\n reasoning: {\n type: \"string\",\n },\n noToolAvailable: {\n type: \"boolean\",\n },\n },\n} as const;\n\nexport interface ToolSelectionName {\n readonly serverName: string;\n readonly toolName: string;\n readonly reasoning?: string;\n readonly noToolAvailable?: boolean;\n}\n\nexport const toolSelectionArgumentSchema = {\n type: \"object\",\n required: [\"toolArguments\"],\n properties: {\n toolArguments: {\n type: \"object\",\n },\n },\n} as const;\n\nexport interface ToolSelectionArgument {\n readonly toolArguments: Readonly<Record<string, unknown>>;\n}\n\nexport const ResourceSelectionSchema = {\n type: \"object\",\n required: [\"serverName\", \"uri\"],\n properties: {\n serverName: {\n type: \"string\",\n minLength: 1,\n errorMessage: \"serverName must not be empty\",\n },\n uri: {\n type: \"string\",\n minLength: 1,\n errorMessage: \"uri must not be empty\",\n },\n reasoning: {\n type: \"string\",\n },\n noResourceAvailable: {\n type: \"boolean\",\n },\n },\n} as const;\n\nexport interface ResourceSelection {\n readonly serverName: string;\n readonly uri: string;\n readonly reasoning?: string;\n readonly noResourceAvailable?: boolean;\n}\n\nexport function isToolSelectionName(value: unknown): value is ToolSelectionName {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const obj = value as Record<string, unknown>;\n return (\n typeof obj.serverName === \"string\" &&\n obj.serverName.length > 0 &&\n typeof obj.toolName === \"string\" &&\n obj.toolName.length > 0\n );\n}\n\nexport function isToolSelectionArgument(value: unknown): value is ToolSelectionArgument {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const obj = value as Record<string, unknown>;\n return typeof obj.toolArguments === \"object\" && obj.toolArguments !== null;\n}\n\nexport function isResourceSelection(value: unknown): value is ResourceSelection {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const obj = value as Record<string, unknown>;\n return (\n typeof obj.serverName === \"string\" &&\n obj.serverName.length > 0 &&\n typeof obj.uri === \"string\" &&\n obj.uri.length > 0\n );\n}\n",
20
+ "import type { State } from \"@elizaos/core\";\nimport {\n type McpProviderData,\n type McpServerInfo,\n ResourceSelectionSchema,\n type ValidationResult,\n} from \"../types\";\nimport { validateJsonSchema } from \"./json\";\nimport {\n type ResourceSelection,\n type ToolSelectionArgument,\n type ToolSelectionName,\n toolSelectionArgumentSchema,\n toolSelectionNameSchema,\n} from \"./schemas\";\n\nexport type { ResourceSelection } from \"./schemas\";\n\nexport interface ToolSelection {\n readonly serverName: string;\n readonly toolName: string;\n readonly arguments: Readonly<Record<string, unknown>>;\n readonly reasoning?: string;\n readonly noToolAvailable?: boolean;\n}\n\nexport function validateToolSelectionName(\n parsed: unknown,\n state: State\n): ValidationResult<ToolSelectionName> {\n const basicResult = validateJsonSchema<ToolSelectionName>(parsed, toolSelectionNameSchema);\n if (basicResult.success === false) {\n return { success: false, error: basicResult.error };\n }\n\n const data = basicResult.data;\n const mcpData = (state.values.mcp ?? {}) as Record<string, McpServerInfo>;\n const server = mcpData[data.serverName];\n\n if (!server || server.status !== \"connected\") {\n return {\n success: false,\n error: `Server \"${data.serverName}\" not found or not connected`,\n };\n }\n\n const toolInfo = server.tools?.[data.toolName];\n if (!toolInfo) {\n return {\n success: false,\n error: `Tool \"${data.toolName}\" not found on server \"${data.serverName}\"`,\n };\n }\n\n return { success: true, data };\n}\n\nexport function validateToolSelectionArgument(\n parsed: unknown,\n toolInputSchema: Readonly<Record<string, unknown>>\n): ValidationResult<ToolSelectionArgument> {\n const basicResult = validateJsonSchema<ToolSelectionArgument>(\n parsed,\n toolSelectionArgumentSchema\n );\n if (basicResult.success === false) {\n return { success: false, error: basicResult.error };\n }\n\n const data = basicResult.data;\n const validationResult = validateJsonSchema(data.toolArguments, toolInputSchema);\n\n if (validationResult.success === false) {\n return {\n success: false,\n error: `Invalid arguments: ${validationResult.error}`,\n };\n }\n\n return { success: true, data };\n}\n\nexport function validateResourceSelection(selection: unknown): ValidationResult<ResourceSelection> {\n return validateJsonSchema<ResourceSelection>(selection, ResourceSelectionSchema);\n}\n\ninterface ToolDescription {\n readonly description?: string;\n}\n\nexport function createToolSelectionFeedbackPrompt(\n originalResponse: string,\n errorMessage: string,\n composedState: State,\n userMessage: string\n): string {\n let toolsDescription = \"\";\n const mcpData = composedState.values.mcp as Record<string, McpProviderData[string]> | undefined;\n\n if (mcpData) {\n for (const [serverName, server] of Object.entries(mcpData)) {\n if (server.status !== \"connected\") continue;\n\n const tools = server.tools as Record<string, ToolDescription> | undefined;\n if (tools) {\n for (const [toolName, tool] of Object.entries(tools)) {\n toolsDescription += `Tool: ${toolName} (Server: ${serverName})\\n`;\n toolsDescription += `Description: ${tool.description ?? \"No description available\"}\\n\\n`;\n }\n }\n }\n }\n\n return createFeedbackPrompt(\n originalResponse,\n errorMessage,\n \"tool\",\n toolsDescription,\n userMessage\n );\n}\n\ninterface ResourceDescription {\n readonly description?: string;\n readonly name?: string;\n}\n\nexport function createResourceSelectionFeedbackPrompt(\n originalResponse: string,\n errorMessage: string,\n composedState: State,\n userMessage: string\n): string {\n let resourcesDescription = \"\";\n const mcpData = composedState.values.mcp as Record<string, McpProviderData[string]> | undefined;\n\n if (mcpData) {\n for (const [serverName, server] of Object.entries(mcpData)) {\n if (server.status !== \"connected\") continue;\n\n const resources = server.resources as Record<string, ResourceDescription> | undefined;\n if (resources) {\n for (const [uri, resource] of Object.entries(resources)) {\n resourcesDescription += `Resource: ${uri} (Server: ${serverName})\\n`;\n resourcesDescription += `Name: ${resource.name ?? \"No name available\"}\\n`;\n resourcesDescription += `Description: ${\n resource.description ?? \"No description available\"\n }\\n\\n`;\n }\n }\n }\n }\n\n return createFeedbackPrompt(\n originalResponse,\n errorMessage,\n \"resource\",\n resourcesDescription,\n userMessage\n );\n}\n\nfunction createFeedbackPrompt(\n originalResponse: string,\n errorMessage: string,\n itemType: string,\n itemsDescription: string,\n userMessage: string\n): string {\n return `Error parsing JSON: ${errorMessage}\n\nYour original response:\n${originalResponse}\n\nPlease try again with valid JSON for ${itemType} selection.\nAvailable ${itemType}s:\n${itemsDescription}\n\nUser request: ${userMessage}`;\n}\n",
21
+ "import {\n type HandlerCallback,\n type IAgentRuntime,\n type Memory,\n ModelType,\n type State,\n} from \"@elizaos/core\";\nimport { DEFAULT_MAX_RETRIES, type McpSettings, type ValidationResult } from \"../types\";\nimport { parseJSON } from \"./json\";\n\nexport type Input = string | Record<string, unknown>;\n\ntype CreateFeedbackPromptFn = (\n originalResponse: Input,\n errorMessage: string,\n composedState: State,\n userMessage: string\n) => string;\n\nexport interface WithModelRetryOptions<T> {\n readonly runtime: IAgentRuntime;\n readonly message: Memory;\n readonly state: State;\n readonly input: Input;\n readonly validationFn: (data: Input) => ValidationResult<T>;\n readonly createFeedbackPromptFn: CreateFeedbackPromptFn;\n readonly callback?: HandlerCallback;\n readonly failureMsg?: string;\n readonly retryCount?: number;\n}\n\nexport async function withModelRetry<T>({\n runtime,\n message,\n state,\n callback,\n input,\n validationFn,\n createFeedbackPromptFn,\n failureMsg,\n retryCount = 0,\n}: WithModelRetryOptions<T>): Promise<T | null> {\n const maxRetries = getMaxRetries(runtime);\n\n const parsedJson = typeof input === \"string\" ? parseJSON<Record<string, unknown>>(input) : input;\n\n const validationResult = validationFn(parsedJson);\n\n if (validationResult.success) {\n return validationResult.data;\n }\n\n const errorMessage = (validationResult as { success: false; error: string }).error;\n\n if (retryCount < maxRetries) {\n const feedbackPrompt: string = createFeedbackPromptFn(\n input,\n errorMessage,\n state,\n message.content.text ?? \"\"\n );\n\n const retrySelection = (await runtime.useModel(ModelType.OBJECT_LARGE, {\n prompt: feedbackPrompt,\n })) as Record<string, unknown>;\n\n return withModelRetry({\n runtime,\n input: retrySelection,\n validationFn,\n message,\n state,\n createFeedbackPromptFn,\n callback,\n failureMsg,\n retryCount: retryCount + 1,\n });\n }\n\n if (callback && failureMsg) {\n await callback({\n text: failureMsg,\n actions: [\"REPLY\"],\n });\n }\n\n return null;\n}\n\nfunction getMaxRetries(runtime: IAgentRuntime): number {\n const rawSettings = runtime.getSetting(\"mcp\");\n\n if (rawSettings && typeof rawSettings === \"object\") {\n const settings = rawSettings as McpSettings;\n if (typeof settings.maxRetries === \"number\" && settings.maxRetries >= 0) {\n return settings.maxRetries;\n }\n }\n\n return DEFAULT_MAX_RETRIES;\n}\n",
22
+ "import type {\n Action,\n ActionResult,\n HandlerCallback,\n IAgentRuntime,\n Memory,\n State,\n} from \"@elizaos/core\";\nimport type { McpService } from \"../service\";\nimport { MCP_SERVICE_NAME, type McpServer } from \"../types\";\nimport { handleMcpError } from \"../utils/error\";\nimport { handleNoToolAvailable } from \"../utils/handler\";\nimport { handleToolResponse, processToolResult } from \"../utils/processing\";\nimport { createToolSelectionArgument, createToolSelectionName } from \"../utils/selection\";\n\nexport const callToolAction: Action = {\n name: \"CALL_MCP_TOOL\",\n similes: [\n \"CALL_TOOL\",\n \"CALL_MCP_TOOL\",\n \"USE_TOOL\",\n \"USE_MCP_TOOL\",\n \"EXECUTE_TOOL\",\n \"EXECUTE_MCP_TOOL\",\n \"RUN_TOOL\",\n \"RUN_MCP_TOOL\",\n \"INVOKE_TOOL\",\n \"INVOKE_MCP_TOOL\",\n ],\n description: \"Calls a tool from an MCP server to perform a specific task\",\n\n validate: async (runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> => {\n const mcpService = runtime.getService<McpService>(MCP_SERVICE_NAME);\n if (!mcpService) return false;\n\n const servers = mcpService.getServers();\n return (\n servers.length > 0 &&\n servers.some(\n (server: McpServer) =>\n server.status === \"connected\" && server.tools && server.tools.length > 0\n )\n );\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> => {\n const composedState = await runtime.composeState(message, [\"RECENT_MESSAGES\", \"MCP\"]);\n const mcpService = runtime.getService<McpService>(MCP_SERVICE_NAME);\n if (!mcpService) {\n throw new Error(\"MCP service not available\");\n }\n const mcpProvider = mcpService.getProviderData();\n\n try {\n const toolSelectionName = await createToolSelectionName({\n runtime,\n state: composedState,\n message,\n callback,\n mcpProvider,\n });\n if (!toolSelectionName || toolSelectionName.noToolAvailable) {\n return await handleNoToolAvailable(callback, toolSelectionName);\n }\n const { serverName, toolName } = toolSelectionName;\n\n const toolSelectionArgument = await createToolSelectionArgument({\n runtime,\n state: composedState,\n message,\n callback,\n mcpProvider,\n toolSelectionName,\n });\n if (!toolSelectionArgument) {\n return await handleNoToolAvailable(callback, toolSelectionName);\n }\n\n const result = await mcpService.callTool(\n serverName,\n toolName,\n toolSelectionArgument.toolArguments\n );\n\n const { toolOutput, hasAttachments, attachments } = processToolResult(\n result,\n serverName,\n toolName,\n runtime,\n message.entityId\n );\n\n const replyMemory = await handleToolResponse(\n runtime,\n message,\n serverName,\n toolName,\n toolSelectionArgument.toolArguments,\n toolOutput,\n hasAttachments,\n attachments,\n composedState,\n mcpProvider,\n callback\n );\n\n return {\n text: `Successfully called tool: ${serverName}/${toolName}. Reasoned response: ${replyMemory.content.text}`,\n values: {\n success: true,\n toolExecuted: true,\n serverName,\n toolName,\n hasAttachments,\n output: toolOutput,\n },\n data: {\n actionName: \"CALL_MCP_TOOL\",\n serverName,\n toolName,\n toolArgumentsJson: JSON.stringify(toolSelectionArgument.toolArguments),\n reasoning: toolSelectionName.reasoning,\n output: toolOutput,\n attachmentCount: attachments?.length ?? 0,\n },\n success: true,\n };\n } catch (error) {\n return await handleMcpError(\n composedState,\n mcpProvider,\n error,\n runtime,\n message,\n \"tool\",\n callback\n );\n }\n },\n\n examples: [\n [\n {\n name: \"{{user}}\",\n content: {\n text: \"Can you search for information about climate change?\",\n },\n },\n {\n name: \"{{assistant}}\",\n content: {\n text: \"I'll help you with that request. Let me access the right tool...\",\n actions: [\"CALL_MCP_TOOL\"],\n },\n },\n {\n name: \"{{assistant}}\",\n content: {\n text: \"I found the following information about climate change:\\n\\nClimate change refers to long-term shifts in temperatures and weather patterns. These shifts may be natural, but since the 1800s, human activities have been the main driver of climate change, primarily due to the burning of fossil fuels like coal, oil, and gas, which produces heat-trapping gases.\",\n actions: [\"CALL_MCP_TOOL\"],\n },\n },\n ],\n ],\n};\n",
23
+ "import {\n type Action,\n type ActionResult,\n composePromptFromState,\n type HandlerCallback,\n type IAgentRuntime,\n type Memory,\n ModelType,\n type State,\n} from \"@elizaos/core\";\nimport type { McpService } from \"../service\";\nimport { resourceSelectionTemplate } from \"../templates/resourceSelectionTemplate\";\nimport { MCP_SERVICE_NAME, type McpServer, type McpServerInfo } from \"../types\";\nimport { handleMcpError } from \"../utils/error\";\nimport {\n handleResourceAnalysis,\n processResourceResult,\n sendInitialResponse,\n} from \"../utils/processing\";\nimport type { ResourceSelection } from \"../utils/schemas\";\nimport {\n createResourceSelectionFeedbackPrompt,\n validateResourceSelection,\n} from \"../utils/validation\";\nimport { withModelRetry } from \"../utils/wrapper\";\n\nfunction createResourceSelectionPrompt(composedState: State, userMessage: string): string {\n const mcpData = (composedState.values.mcp ?? {}) as Record<string, McpServerInfo>;\n const serverNames = Object.keys(mcpData);\n\n let resourcesDescription = \"\";\n for (const serverName of serverNames) {\n const server = mcpData[serverName];\n if (server.status !== \"connected\") continue;\n\n const resourceUris = Object.keys(server.resources ?? {});\n for (const uri of resourceUris) {\n const resource = server.resources[uri];\n resourcesDescription += `Resource: ${uri} (Server: ${serverName})\\n`;\n resourcesDescription += `Name: ${resource.name ?? \"No name available\"}\\n`;\n resourcesDescription += `Description: ${\n resource.description ?? \"No description available\"\n }\\n`;\n resourcesDescription += `MIME Type: ${resource.mimeType ?? \"Not specified\"}\\n\\n`;\n }\n }\n\n const enhancedState: State = {\n ...composedState,\n values: {\n ...composedState.values,\n resourcesDescription,\n userMessage,\n },\n };\n\n return composePromptFromState({\n state: enhancedState,\n template: resourceSelectionTemplate,\n });\n}\n\nexport const readResourceAction: Action = {\n name: \"READ_MCP_RESOURCE\",\n similes: [\n \"READ_RESOURCE\",\n \"READ_MCP_RESOURCE\",\n \"GET_RESOURCE\",\n \"GET_MCP_RESOURCE\",\n \"FETCH_RESOURCE\",\n \"FETCH_MCP_RESOURCE\",\n \"ACCESS_RESOURCE\",\n \"ACCESS_MCP_RESOURCE\",\n ],\n description: \"Reads a resource from an MCP server\",\n\n validate: async (runtime: IAgentRuntime, _message: Memory, _state?: State): Promise<boolean> => {\n const mcpService = runtime.getService<McpService>(MCP_SERVICE_NAME);\n if (!mcpService) return false;\n\n const servers = mcpService.getServers();\n return (\n servers.length > 0 &&\n servers.some(\n (server: McpServer) =>\n server.status === \"connected\" && server.resources && server.resources.length > 0\n )\n );\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: Record<string, unknown>,\n callback?: HandlerCallback\n ): Promise<ActionResult> => {\n const composedState = await runtime.composeState(message, [\"RECENT_MESSAGES\", \"MCP\"]);\n\n const mcpService = runtime.getService<McpService>(MCP_SERVICE_NAME);\n if (!mcpService) {\n throw new Error(\"MCP service not available\");\n }\n\n const mcpProvider = mcpService.getProviderData();\n\n try {\n await sendInitialResponse(callback);\n\n const resourceSelectionPrompt = createResourceSelectionPrompt(\n composedState,\n message.content.text ?? \"\"\n );\n\n const resourceSelection = (await runtime.useModel(ModelType.TEXT_SMALL, {\n prompt: resourceSelectionPrompt,\n })) as string;\n\n const parsedSelection = await withModelRetry<ResourceSelection>({\n runtime,\n state: composedState,\n message,\n callback,\n input: resourceSelection,\n validationFn: (data) => validateResourceSelection(data),\n createFeedbackPromptFn: (originalResponse, errorMessage, state, userMessage) =>\n createResourceSelectionFeedbackPrompt(\n typeof originalResponse === \"string\"\n ? originalResponse\n : JSON.stringify(originalResponse),\n errorMessage,\n state,\n userMessage\n ),\n failureMsg: `I'm having trouble finding the resource you're looking for. Could you provide more details about what you need?`,\n retryCount: 0,\n });\n\n if (!parsedSelection || parsedSelection.noResourceAvailable) {\n const responseText =\n \"I don't have a specific resource that contains the information you're looking for. Let me try to assist you directly instead.\";\n\n if (callback && parsedSelection?.noResourceAvailable) {\n await callback({\n text: responseText,\n actions: [\"REPLY\"],\n });\n }\n return {\n text: responseText,\n values: {\n success: true,\n noResourceAvailable: true,\n fallbackToDirectAssistance: true,\n },\n data: {\n actionName: \"READ_MCP_RESOURCE\",\n noResourceAvailable: true,\n reason: parsedSelection?.reasoning ?? \"No appropriate resource available\",\n },\n success: true,\n };\n }\n\n const { serverName, uri } = parsedSelection;\n\n const result = await mcpService.readResource(serverName, uri);\n\n const { resourceContent, resourceMeta } = processResourceResult(result, uri);\n\n await handleResourceAnalysis(\n runtime,\n message,\n uri,\n serverName,\n resourceContent,\n resourceMeta,\n callback\n );\n\n return {\n text: `Successfully read resource: ${uri}`,\n values: {\n success: true,\n resourceRead: true,\n serverName,\n uri,\n },\n data: {\n actionName: \"READ_MCP_RESOURCE\",\n serverName,\n uri,\n reasoning: parsedSelection?.reasoning,\n resourceMeta,\n contentLength: resourceContent?.length ?? 0,\n },\n success: true,\n };\n } catch (error) {\n return await handleMcpError(\n composedState,\n mcpProvider,\n error,\n runtime,\n message,\n \"resource\",\n callback\n );\n }\n },\n\n examples: [\n [\n {\n name: \"{{user}}\",\n content: {\n text: \"Can you get the documentation about installing elizaOS?\",\n },\n },\n {\n name: \"{{assistant}}\",\n content: {\n text: `I'll retrieve that information for you. Let me access the resource...`,\n actions: [\"READ_MCP_RESOURCE\"],\n },\n },\n {\n name: \"{{assistant}}\",\n content: {\n text: `elizaOS installation is straightforward. You'll need Node.js 23+ and Git installed. For Windows users, WSL 2 is required. The quickest way to get started is by cloning the elizaOS starter repository with \\`git clone https://github.com/elizaos/eliza-starter.git\\`, then run \\`cd eliza-starter && cp .env.example .env && bun i && bun run build && bun start\\`. This will set up a development environment with the core features enabled. After starting, you can access the web interface at http://localhost:3000 to interact with your agent.`,\n actions: [\"READ_MCP_RESOURCE\"],\n },\n },\n ],\n ],\n};\n",
24
+ "import type { IAgentRuntime, Memory, Provider, ProviderResult, State } from \"@elizaos/core\";\nimport type { McpService } from \"./service\";\nimport { MCP_SERVICE_NAME } from \"./types\";\n\nexport const provider: Provider = {\n name: \"MCP\",\n description: \"Information about connected MCP servers, tools, and resources\",\n\n get: async (runtime: IAgentRuntime, _message: Memory, _state: State): Promise<ProviderResult> => {\n const mcpService = runtime.getService<McpService>(MCP_SERVICE_NAME);\n if (!mcpService) {\n return {\n values: {},\n data: {},\n text: \"No MCP servers are available.\",\n };\n }\n\n const providerData = mcpService.getProviderData();\n return {\n values: { mcpServers: JSON.stringify(providerData.values.mcp) },\n data: { mcpServerCount: Object.keys(providerData.data.mcp).length },\n text: providerData.text,\n };\n },\n};\n",
25
+ "import { type IAgentRuntime, logger, Service } from \"@elizaos/core\";\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport { SSEClientTransport } from \"@modelcontextprotocol/sdk/client/sse.js\";\nimport { StdioClientTransport } from \"@modelcontextprotocol/sdk/client/stdio.js\";\nimport type {\n CallToolResult,\n Resource,\n ResourceTemplate,\n Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport {\n createMcpToolCompatibilitySync as createMcpToolCompatibility,\n type McpToolCompatibility,\n} from \"./tool-compatibility\";\nimport {\n BACKOFF_MULTIPLIER,\n type ConnectionState,\n DEFAULT_MCP_TIMEOUT_SECONDS,\n DEFAULT_PING_CONFIG,\n type HttpMcpServerConfig,\n INITIAL_RETRY_DELAY,\n MAX_RECONNECT_ATTEMPTS,\n MCP_SERVICE_NAME,\n type McpConnection,\n type McpProvider,\n type McpResourceResponse,\n type McpServer,\n type McpServerConfig,\n type McpSettings,\n type PingConfig,\n type StdioMcpServerConfig,\n} from \"./types\";\nimport { buildMcpProviderData } from \"./utils/mcp\";\n\nexport class McpService extends Service {\n static serviceType: string = MCP_SERVICE_NAME;\n capabilityDescription = \"Enables the agent to interact with MCP (Model Context Protocol) servers\";\n\n private connections: Map<string, McpConnection> = new Map();\n private connectionStates: Map<string, ConnectionState> = new Map();\n private mcpProvider: McpProvider = {\n values: { mcp: {}, mcpText: \"\" },\n data: { mcp: {} },\n text: \"\",\n };\n private pingConfig: PingConfig = DEFAULT_PING_CONFIG;\n private toolCompatibility: McpToolCompatibility | null = null;\n private compatibilityInitialized = false;\n\n private initializationPromise: Promise<void> | null = null;\n\n constructor(runtime: IAgentRuntime) {\n super(runtime);\n this.initializationPromise = this.initializeMcpServers();\n }\n\n static async start(runtime: IAgentRuntime): Promise<McpService> {\n const service = new McpService(runtime);\n if (service.initializationPromise) {\n await service.initializationPromise;\n }\n return service;\n }\n\n async waitForInitialization(): Promise<void> {\n if (this.initializationPromise) {\n await this.initializationPromise;\n }\n }\n\n async stop(): Promise<void> {\n for (const [name] of this.connections) {\n await this.deleteConnection(name);\n }\n this.connections.clear();\n for (const state of this.connectionStates.values()) {\n if (state.pingInterval) clearInterval(state.pingInterval);\n if (state.reconnectTimeout) clearTimeout(state.reconnectTimeout);\n }\n this.connectionStates.clear();\n }\n\n private async initializeMcpServers(): Promise<void> {\n const mcpSettings = this.getMcpSettings();\n\n if (!mcpSettings || !mcpSettings.servers || Object.keys(mcpSettings.servers).length === 0) {\n this.mcpProvider = buildMcpProviderData([]);\n return;\n }\n\n await this.updateServerConnections(mcpSettings.servers);\n const servers = this.getServers();\n this.mcpProvider = buildMcpProviderData(servers);\n }\n\n private getMcpSettings(): McpSettings | undefined {\n const rawSettings = this.runtime.getSetting(\"mcp\");\n let settings: McpSettings | null | undefined = null;\n\n if (rawSettings && typeof rawSettings === \"object\" && !Array.isArray(rawSettings)) {\n const parsed = rawSettings as Record<string, unknown>;\n if (\"servers\" in parsed && typeof parsed.servers === \"object\" && parsed.servers !== null) {\n settings = parsed as unknown as McpSettings;\n }\n }\n\n if (!settings || !settings.servers) {\n const characterSettings = this.runtime.character.settings;\n if (\n characterSettings &&\n typeof characterSettings === \"object\" &&\n \"mcp\" in characterSettings\n ) {\n const characterMcpSettings = characterSettings.mcp;\n if (\n characterMcpSettings &&\n typeof characterMcpSettings === \"object\" &&\n \"servers\" in characterMcpSettings\n ) {\n settings = characterMcpSettings as unknown as McpSettings;\n }\n }\n }\n\n if (settings && typeof settings === \"object\" && settings.servers) {\n return settings;\n }\n\n return undefined;\n }\n\n private async updateServerConnections(\n serverConfigs: Readonly<Record<string, McpServerConfig>>\n ): Promise<void> {\n const currentNames = new Set(this.connections.keys());\n const newNames = new Set(Object.keys(serverConfigs));\n\n for (const name of currentNames) {\n if (!newNames.has(name)) {\n await this.deleteConnection(name);\n }\n }\n\n const connectionPromises = Object.entries(serverConfigs).map(async ([name, config]) => {\n const currentConnection = this.connections.get(name);\n if (!currentConnection) {\n await this.initializeConnection(name, config);\n } else if (JSON.stringify(config) !== currentConnection.server.config) {\n await this.deleteConnection(name);\n await this.initializeConnection(name, config);\n }\n });\n\n await Promise.allSettled(connectionPromises);\n }\n\n private async initializeConnection(name: string, config: McpServerConfig): Promise<void> {\n await this.deleteConnection(name);\n const state: ConnectionState = {\n status: \"connecting\",\n reconnectAttempts: 0,\n consecutivePingFailures: 0,\n };\n this.connectionStates.set(name, state);\n\n const client = new Client({ name: \"elizaOS\", version: \"1.0.0\" }, { capabilities: {} });\n const transport: StdioClientTransport | SSEClientTransport =\n config.type === \"stdio\"\n ? await this.buildStdioClientTransport(name, config)\n : await this.buildHttpClientTransport(name, config);\n\n const connection: McpConnection = {\n server: {\n name,\n config: JSON.stringify(config),\n status: \"connecting\",\n },\n client,\n transport,\n };\n this.connections.set(name, connection);\n this.setupTransportHandlers(name, connection, state);\n await client.connect(transport);\n\n const capabilities = client.getServerCapabilities();\n const tools = await this.fetchToolsList(name);\n const resources = capabilities?.resources ? await this.fetchResourcesList(name) : [];\n const resourceTemplates = capabilities?.resources\n ? await this.fetchResourceTemplatesList(name)\n : [];\n\n connection.server = {\n status: \"connected\",\n name,\n config: JSON.stringify(config),\n error: \"\",\n tools,\n resources,\n resourceTemplates,\n };\n state.status = \"connected\";\n state.lastConnected = new Date();\n state.reconnectAttempts = 0;\n state.consecutivePingFailures = 0;\n this.startPingMonitoring(name);\n }\n\n private setupTransportHandlers(\n name: string,\n connection: McpConnection,\n _state: ConnectionState\n ): void {\n const config = JSON.parse(connection.server.config) as McpServerConfig;\n const isHttpTransport = config.type !== \"stdio\";\n\n connection.transport.onerror = async (error): Promise<void> => {\n const errorMessage = error?.message ?? String(error);\n const isExpectedTimeout =\n isHttpTransport &&\n (errorMessage === \"undefined\" ||\n errorMessage === \"\" ||\n errorMessage.includes(\"SSE error\") ||\n errorMessage.includes(\"timeout\"));\n\n if (!isExpectedTimeout) {\n logger.error({ error, serverName: name }, `Transport error for \"${name}\"`);\n connection.server.status = \"disconnected\";\n this.appendErrorMessage(connection, error.message);\n }\n\n if (!isHttpTransport) {\n this.handleDisconnection(name, error);\n }\n };\n\n connection.transport.onclose = async (): Promise<void> => {\n if (!isHttpTransport) {\n connection.server.status = \"disconnected\";\n this.handleDisconnection(name, new Error(\"Transport closed\"));\n }\n };\n }\n\n private startPingMonitoring(name: string): void {\n const connection = this.connections.get(name);\n if (!connection) return;\n\n const config = JSON.parse(connection.server.config) as McpServerConfig;\n const isHttpTransport = config.type !== \"stdio\";\n\n if (isHttpTransport) {\n return;\n }\n\n const state = this.connectionStates.get(name);\n if (!state || !this.pingConfig.enabled) return;\n if (state.pingInterval) clearInterval(state.pingInterval);\n state.pingInterval = setInterval(() => {\n this.sendPing(name).catch((err: Error) => {\n logger.warn({ error: err.message, serverName: name }, `Ping failed for ${name}`);\n this.handlePingFailure(name, err);\n });\n }, this.pingConfig.intervalMs);\n }\n\n private async sendPing(name: string): Promise<void> {\n const connection = this.connections.get(name);\n if (!connection) throw new Error(`No connection for ping: ${name}`);\n\n await Promise.race([\n connection.client.listTools(),\n new Promise<never>((_, reject) =>\n setTimeout(() => reject(new Error(\"Ping timeout\")), this.pingConfig.timeoutMs)\n ),\n ]);\n\n const state = this.connectionStates.get(name);\n if (state) state.consecutivePingFailures = 0;\n }\n\n private handlePingFailure(name: string, error: Error): void {\n const state = this.connectionStates.get(name);\n if (!state) return;\n state.consecutivePingFailures++;\n if (state.consecutivePingFailures >= this.pingConfig.failuresBeforeDisconnect) {\n this.handleDisconnection(name, error);\n }\n }\n\n private handleDisconnection(name: string, error: Error | unknown): void {\n const state = this.connectionStates.get(name);\n if (!state) return;\n state.status = \"disconnected\";\n state.lastError = error instanceof Error ? error : new Error(String(error));\n if (state.pingInterval) clearInterval(state.pingInterval);\n if (state.reconnectTimeout) clearTimeout(state.reconnectTimeout);\n if (state.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {\n return;\n }\n const delay = INITIAL_RETRY_DELAY * BACKOFF_MULTIPLIER ** state.reconnectAttempts;\n state.reconnectTimeout = setTimeout(async () => {\n state.reconnectAttempts++;\n const connection = this.connections.get(name);\n const config = connection?.server?.config;\n if (config) {\n try {\n await this.initializeConnection(name, JSON.parse(config));\n } catch (err) {\n this.handleDisconnection(name, err);\n }\n }\n }, delay);\n }\n\n async deleteConnection(name: string): Promise<void> {\n const connection = this.connections.get(name);\n if (connection) {\n await connection.transport.close();\n await connection.client.close();\n this.connections.delete(name);\n }\n const state = this.connectionStates.get(name);\n if (state) {\n if (state.pingInterval) clearInterval(state.pingInterval);\n if (state.reconnectTimeout) clearTimeout(state.reconnectTimeout);\n this.connectionStates.delete(name);\n }\n }\n\n private getServerConnection(serverName: string): McpConnection | undefined {\n return this.connections.get(serverName);\n }\n\n private async buildStdioClientTransport(\n name: string,\n config: StdioMcpServerConfig\n ): Promise<StdioClientTransport> {\n if (!config.command) {\n throw new Error(`Missing command for stdio MCP server ${name}`);\n }\n\n return new StdioClientTransport({\n command: config.command,\n args: config.args ? [...config.args] : undefined,\n env: {\n ...config.env,\n ...(process.env.PATH ? { PATH: process.env.PATH } : {}),\n },\n stderr: \"pipe\",\n cwd: config.cwd,\n });\n }\n\n private async buildHttpClientTransport(\n name: string,\n config: HttpMcpServerConfig\n ): Promise<SSEClientTransport> {\n if (!config.url) {\n throw new Error(`Missing URL for HTTP MCP server ${name}`);\n }\n\n return new SSEClientTransport(new URL(config.url));\n }\n\n private appendErrorMessage(connection: McpConnection, error: string): void {\n const newError = connection.server.error ? `${connection.server.error}\\n${error}` : error;\n connection.server.error = newError;\n }\n\n private async fetchToolsList(serverName: string): Promise<Tool[]> {\n const connection = this.getServerConnection(serverName);\n if (!connection) {\n return [];\n }\n\n const response = await connection.client.listTools();\n\n const tools = (response?.tools ?? []).map((tool) => {\n const processedTool = { ...tool };\n\n if (tool.inputSchema) {\n if (!this.compatibilityInitialized) {\n this.initializeToolCompatibility();\n }\n\n processedTool.inputSchema = this.applyToolCompatibility(\n tool.inputSchema as JSONSchema7\n ) as typeof tool.inputSchema;\n }\n\n return processedTool;\n });\n\n return tools;\n }\n\n private async fetchResourcesList(serverName: string): Promise<Resource[]> {\n const connection = this.getServerConnection(serverName);\n if (!connection) {\n return [];\n }\n\n const response = await connection.client.listResources();\n return response?.resources ?? [];\n }\n\n private async fetchResourceTemplatesList(serverName: string): Promise<ResourceTemplate[]> {\n const connection = this.getServerConnection(serverName);\n if (!connection) {\n return [];\n }\n\n const response = await connection.client.listResourceTemplates();\n return response?.resourceTemplates ?? [];\n }\n\n public getServers(): McpServer[] {\n return Array.from(this.connections.values())\n .filter((conn) => !conn.server.disabled)\n .map((conn) => conn.server);\n }\n\n public getProviderData(): McpProvider {\n return this.mcpProvider;\n }\n\n public async callTool(\n serverName: string,\n toolName: string,\n toolArguments?: Readonly<Record<string, unknown>>\n ): Promise<CallToolResult> {\n const connection = this.connections.get(serverName);\n if (!connection) {\n throw new Error(`No connection found for server: ${serverName}`);\n }\n if (connection.server.disabled) {\n throw new Error(`Server \"${serverName}\" is disabled`);\n }\n\n let timeout = DEFAULT_MCP_TIMEOUT_SECONDS;\n const config = JSON.parse(connection.server.config) as McpServerConfig;\n if (config.type === \"stdio\" && config.timeoutInMillis) {\n timeout = config.timeoutInMillis;\n }\n\n const result = await connection.client.callTool(\n {\n name: toolName,\n arguments: toolArguments ? { ...toolArguments } : undefined,\n },\n undefined,\n { timeout }\n );\n if (!result.content) {\n throw new Error(\"Invalid tool result: missing content array\");\n }\n return result as CallToolResult;\n }\n\n public async readResource(serverName: string, uri: string): Promise<McpResourceResponse> {\n const connection = this.connections.get(serverName);\n if (!connection) {\n throw new Error(`No connection found for server: ${serverName}`);\n }\n if (connection.server.disabled) {\n throw new Error(`Server \"${serverName}\" is disabled`);\n }\n return await connection.client.readResource({ uri });\n }\n\n public async restartConnection(serverName: string): Promise<void> {\n const connection = this.connections.get(serverName);\n const config = connection?.server?.config;\n if (config) {\n connection.server.status = \"connecting\";\n connection.server.error = \"\";\n await this.deleteConnection(serverName);\n await this.initializeConnection(serverName, JSON.parse(config));\n }\n }\n\n private initializeToolCompatibility(): void {\n if (this.compatibilityInitialized) return;\n\n this.toolCompatibility = createMcpToolCompatibility(this.runtime);\n this.compatibilityInitialized = true;\n }\n\n public applyToolCompatibility(toolSchema: JSONSchema7): JSONSchema7 {\n if (!this.compatibilityInitialized) {\n this.initializeToolCompatibility();\n }\n\n if (!this.toolCompatibility || !toolSchema) {\n return toolSchema;\n }\n\n return this.toolCompatibility.transformToolSchema(toolSchema);\n }\n}\n",
26
+ "import type { IAgentRuntime } from \"@elizaos/core\";\nimport { detectModelProvider, type McpToolCompatibility } from \"./base\";\n\nexport {\n type ArrayConstraints,\n McpToolCompatibility,\n type ModelInfo,\n type ModelProvider,\n type NumberConstraints,\n type ObjectConstraints,\n type SchemaConstraints,\n type StringConstraints,\n} from \"./base\";\n\nexport { detectModelProvider };\n\nexport async function createMcpToolCompatibility(\n runtime: IAgentRuntime\n): Promise<McpToolCompatibility | null> {\n const modelInfo = detectModelProvider(runtime);\n\n switch (modelInfo.provider) {\n case \"openai\": {\n const { OpenAIMcpCompatibility } = await import(\"./providers/openai.js\");\n return new OpenAIMcpCompatibility(modelInfo);\n }\n case \"anthropic\": {\n const { AnthropicMcpCompatibility } = await import(\"./providers/anthropic.js\");\n return new AnthropicMcpCompatibility(modelInfo);\n }\n case \"google\": {\n const { GoogleMcpCompatibility } = await import(\"./providers/google.js\");\n return new GoogleMcpCompatibility(modelInfo);\n }\n default:\n return null;\n }\n}\n\nexport function createMcpToolCompatibilitySync(\n runtime: IAgentRuntime\n): McpToolCompatibility | null {\n const modelInfo = detectModelProvider(runtime);\n\n switch (modelInfo.provider) {\n case \"openai\": {\n const { OpenAIMcpCompatibility } = require(\"./providers/openai\");\n return new OpenAIMcpCompatibility(modelInfo);\n }\n case \"anthropic\": {\n const { AnthropicMcpCompatibility } = require(\"./providers/anthropic\");\n return new AnthropicMcpCompatibility(modelInfo);\n }\n case \"google\": {\n const { GoogleMcpCompatibility } = require(\"./providers/google\");\n return new GoogleMcpCompatibility(modelInfo);\n }\n default:\n return null;\n }\n}\n"
27
+ ],
28
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,MAAe,qBAAqB;AAAA,EACtB;AAAA,EAEnB,WAAW,CAAC,WAAsB;AAAA,IAChC,KAAK,YAAY;AAAA;AAAA,EAKZ,mBAAmB,CAAC,YAAsC;AAAA,IAC/D,IAAI,CAAC,KAAK,YAAY,GAAG;AAAA,MACvB,OAAO;AAAA,IACT;AAAA,IAEA,OAAO,KAAK,cAAc,UAAU;AAAA;AAAA,EAG5B,aAAa,CAAC,QAAkC;AAAA,IACxD,MAAM,YAAY,KAAK,OAAO;AAAA,IAE9B,QAAQ,UAAU;AAAA,WACX;AAAA,QACH,OAAO,KAAK,oBAAoB,SAAS;AAAA,WACtC;AAAA,WACA;AAAA,QACH,OAAO,KAAK,oBAAoB,SAAS;AAAA,WACtC;AAA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IAClE,IAAI,CAAC,KAAK,0BAA0B;AAAA,MAClC,KAAK,4BAA4B;AAAA,IACnC;AAAA,IAEA,IAAI,CAAC,KAAK,qBAAqB,CAAC,YAAY;AAAA,MAC1C,OAAO;AAAA,IACT;AAAA,IAEA,OAAO,KAAK,kBAAkB,oBAAoB,UAAU;AAAA;AAEhE;;;AhB9eA,IAAM,YAAoB;AAAA,EACxB,MAAM;AAAA,EACN,aAAa;AAAA,EAEb,MAAM,OAAO,SAAiC,aAA2C;AAAA,IACvF,QAAO,KAAK,4BAA4B;AAAA;AAAA,EAG1C,UAAU,CAAC,UAAU;AAAA,EACrB,SAAS,CAAC,gBAAgB,kBAAkB;AAAA,EAC5C,WAAW,CAAC,QAAQ;AACtB;AAEA,IAAe;",
29
+ "debugId": "9C08B35E0B9B7AB864756E2164756E21",
30
+ "names": []
31
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAI5F,eAAO,MAAM,QAAQ,EAAE,QAqBtB,CAAC"}
@@ -1,6 +1,7 @@
1
- import { type IAgentRuntime, Service } from '@elizaos/core';
2
- import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
- import { type McpProvider, type McpResourceResponse, type McpServer } from './types';
1
+ import { type IAgentRuntime, Service } from "@elizaos/core";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ import type { JSONSchema7 } from "json-schema";
4
+ import { type McpProvider, type McpResourceResponse, type McpServer } from "./types";
4
5
  export declare class McpService extends Service {
5
6
  static serviceType: string;
6
7
  capabilityDescription: string;
@@ -13,9 +14,6 @@ export declare class McpService extends Service {
13
14
  private initializationPromise;
14
15
  constructor(runtime: IAgentRuntime);
15
16
  static start(runtime: IAgentRuntime): Promise<McpService>;
16
- /**
17
- * Wait for initialization to complete (useful if service was created without awaiting start)
18
- */
19
17
  waitForInitialization(): Promise<void>;
20
18
  stop(): Promise<void>;
21
19
  private initializeMcpServers;
@@ -37,10 +35,10 @@ export declare class McpService extends Service {
37
35
  private fetchResourceTemplatesList;
38
36
  getServers(): McpServer[];
39
37
  getProviderData(): McpProvider;
40
- callTool(serverName: string, toolName: string, toolArguments?: Record<string, unknown>): Promise<CallToolResult>;
38
+ callTool(serverName: string, toolName: string, toolArguments?: Readonly<Record<string, unknown>>): Promise<CallToolResult>;
41
39
  readResource(serverName: string, uri: string): Promise<McpResourceResponse>;
42
40
  restartConnection(serverName: string): Promise<void>;
43
41
  private initializeToolCompatibility;
44
- applyToolCompatibility(toolSchema: any): any;
42
+ applyToolCompatibility(toolSchema: JSONSchema7): JSONSchema7;
45
43
  }
46
44
  //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAU,OAAO,EAAE,MAAM,eAAe,CAAC;AAIpE,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,OAAO,EAUL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAKf,MAAM,SAAS,CAAC;AAGjB,qBAAa,UAAW,SAAQ,OAAO;IACrC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAoB;IAC9C,qBAAqB,SAA6E;IAElG,OAAO,CAAC,WAAW,CAAyC;IAC5D,OAAO,CAAC,gBAAgB,CAA2C;IACnE,OAAO,CAAC,WAAW,CAIjB;IACF,OAAO,CAAC,UAAU,CAAmC;IACrD,OAAO,CAAC,iBAAiB,CAAqC;IAC9D,OAAO,CAAC,wBAAwB,CAAS;IAEzC,OAAO,CAAC,qBAAqB,CAA8B;gBAE/C,OAAO,EAAE,aAAa;WAKrB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IAQzD,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMtC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAYb,oBAAoB;IAalC,OAAO,CAAC,cAAc;YAoCR,uBAAuB;YAyBvB,oBAAoB;IAmDlC,OAAO,CAAC,sBAAsB;IAoC9B,OAAO,CAAC,mBAAmB;YAsBb,QAAQ;IAetB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,mBAAmB;IAyBrB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAenD,OAAO,CAAC,mBAAmB;YAIb,yBAAyB;YAoBzB,wBAAwB;IAWtC,OAAO,CAAC,kBAAkB;YAKZ,cAAc;YA2Bd,kBAAkB;YAUlB,0BAA0B;IAUjC,UAAU,IAAI,SAAS,EAAE;IAMzB,eAAe,IAAI,WAAW;IAIxB,QAAQ,CACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAChD,OAAO,CAAC,cAAc,CAAC;IA6Bb,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAW3E,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWjE,OAAO,CAAC,2BAA2B;IAO5B,sBAAsB,CAAC,UAAU,EAAE,WAAW,GAAG,WAAW;CAWpE"}
@@ -0,0 +1,2 @@
1
+ export declare const errorAnalysisPrompt = "{{{mcpProvider.text}}}\n\n{{{recentMessages}}}\n\n# Prompt\n\nYou're an assistant helping a user, but there was an error accessing the resource you tried to use.\n\nUser request: \"{{{userMessage}}}\"\nError message: {{{error}}}\n\nCreate a helpful response that:\n1. Acknowledges the issue in user-friendly terms\n2. Offers alternative approaches to help if possible\n3. Doesn't expose technical error details unless they're truly helpful\n4. Maintains a helpful, conversational tone\n\nYour response:";
2
+ //# sourceMappingURL=errorAnalysisPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorAnalysisPrompt.d.ts","sourceRoot":"","sources":["../../../src/templates/errorAnalysisPrompt.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB,2fAAwB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Feedback template for MCP plugin.
3
+ * Auto-generated from prompts/feedback.txt
4
+ * DO NOT EDIT - Generated from ../generated/prompts/typescript/prompts.ts
5
+ */
6
+ import { feedbackTemplate } from "../generated/prompts/typescript/prompts.js";
7
+ export { feedbackTemplate };
8
+ //# sourceMappingURL=feedbackTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedbackTemplate.d.ts","sourceRoot":"","sources":["../../../src/templates/feedbackTemplate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Resource analysis template for MCP plugin.
3
+ * Auto-generated from prompts/resource_analysis.txt
4
+ * DO NOT EDIT - Generated from ../generated/prompts/typescript/prompts.ts
5
+ */
6
+ import { resourceAnalysisTemplate } from "../generated/prompts/typescript/prompts.js";
7
+ export { resourceAnalysisTemplate };
8
+ //# sourceMappingURL=resourceAnalysisTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceAnalysisTemplate.d.ts","sourceRoot":"","sources":["../../../src/templates/resourceAnalysisTemplate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Resource selection template for MCP plugin.
3
+ * Auto-generated from prompts/resource_selection.txt
4
+ * DO NOT EDIT - Generated from ../generated/prompts/typescript/prompts.ts
5
+ */
6
+ import { resourceSelectionTemplate } from "../generated/prompts/typescript/prompts.js";
7
+ export { resourceSelectionTemplate };
8
+ //# sourceMappingURL=resourceSelectionTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceSelectionTemplate.d.ts","sourceRoot":"","sources":["../../../src/templates/resourceSelectionTemplate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tool reasoning template for MCP plugin.
3
+ * Auto-generated from prompts/tool_reasoning.txt
4
+ * DO NOT EDIT - Generated from ../generated/prompts/typescript/prompts.ts
5
+ */
6
+ import { toolReasoningTemplate } from "../generated/prompts/typescript/prompts.js";
7
+ export { toolReasoningTemplate };
8
+ //# sourceMappingURL=toolReasoningTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolReasoningTemplate.d.ts","sourceRoot":"","sources":["../../../src/templates/toolReasoningTemplate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tool selection templates for MCP plugin.
3
+ * Auto-generated from prompts/tool_selection_*.txt
4
+ * DO NOT EDIT - Generated from ../generated/prompts/typescript/prompts.ts
5
+ */
6
+ import { toolSelectionArgumentTemplate, toolSelectionNameTemplate } from "../generated/prompts/typescript/prompts.js";
7
+ export { toolSelectionNameTemplate, toolSelectionArgumentTemplate };
8
+ //# sourceMappingURL=toolSelectionTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolSelectionTemplate.d.ts","sourceRoot":"","sources":["../../../src/templates/toolSelectionTemplate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EAC1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,CAAC"}
@@ -1,10 +1,11 @@
1
- import type { JSONSchema7 } from 'json-schema';
1
+ import type { IAgentRuntime } from "@elizaos/core";
2
+ import type { JSONSchema7 } from "json-schema";
2
3
  export interface StringConstraints {
3
4
  minLength?: number;
4
5
  maxLength?: number;
5
6
  pattern?: string;
6
7
  format?: string;
7
- enum?: string[];
8
+ enum?: readonly string[];
8
9
  }
9
10
  export interface NumberConstraints {
10
11
  minimum?: number;
@@ -24,15 +25,15 @@ export interface ObjectConstraints {
24
25
  additionalProperties?: boolean;
25
26
  }
26
27
  export type SchemaConstraints = StringConstraints | NumberConstraints | ArrayConstraints | ObjectConstraints;
27
- export type ModelProvider = 'openai' | 'anthropic' | 'google' | 'openrouter' | 'unknown';
28
+ export type ModelProvider = "openai" | "anthropic" | "google" | "openrouter";
28
29
  export interface ModelInfo {
29
- provider: ModelProvider;
30
- modelId: string;
31
- supportsStructuredOutputs?: boolean;
32
- isReasoningModel?: boolean;
30
+ readonly provider: ModelProvider;
31
+ readonly modelId: string;
32
+ readonly supportsStructuredOutputs?: boolean;
33
+ readonly isReasoningModel?: boolean;
33
34
  }
34
35
  export declare abstract class McpToolCompatibility {
35
- protected modelInfo: ModelInfo;
36
+ protected readonly modelInfo: ModelInfo;
36
37
  constructor(modelInfo: ModelInfo);
37
38
  abstract shouldApply(): boolean;
38
39
  transformToolSchema(toolSchema: JSONSchema7): JSONSchema7;
@@ -43,12 +44,10 @@ export declare abstract class McpToolCompatibility {
43
44
  protected processObjectSchema(schema: JSONSchema7): JSONSchema7;
44
45
  protected processGenericSchema(schema: JSONSchema7): JSONSchema7;
45
46
  protected mergeDescription(originalDescription: string | undefined, constraints: SchemaConstraints): string;
46
- protected abstract getUnsupportedStringProperties(): string[];
47
- protected abstract getUnsupportedNumberProperties(): string[];
48
- protected abstract getUnsupportedArrayProperties(): string[];
49
- protected abstract getUnsupportedObjectProperties(): string[];
47
+ protected abstract getUnsupportedStringProperties(): readonly string[];
48
+ protected abstract getUnsupportedNumberProperties(): readonly string[];
49
+ protected abstract getUnsupportedArrayProperties(): readonly string[];
50
+ protected abstract getUnsupportedObjectProperties(): readonly string[];
50
51
  }
51
- export declare function detectModelProvider(runtime: any): ModelInfo;
52
- export declare function createMcpToolCompatibility(runtime: any): Promise<McpToolCompatibility | null>;
53
- export declare function createMcpToolCompatibilitySync(runtime: any): McpToolCompatibility | null;
54
- //# sourceMappingURL=index.d.ts.map
52
+ export declare function detectModelProvider(runtime: IAgentRuntime): ModelInfo;
53
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/tool-compatibility/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MA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,CACxB,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,WAAW,EAAE,iBAAiB,GAC7B,MAAM;IAQT,SAAS,CAAC,QAAQ,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IACtE,SAAS,CAAC,QAAQ,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;IACtE,SAAS,CAAC,QAAQ,CAAC,6BAA6B,IAAI,SAAS,MAAM,EAAE;IACrE,SAAS,CAAC,QAAQ,CAAC,8BAA8B,IAAI,SAAS,MAAM,EAAE;CACvE;AAkCD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAmCrE"}
@@ -0,0 +1,7 @@
1
+ import type { IAgentRuntime } from "@elizaos/core";
2
+ import { detectModelProvider, type McpToolCompatibility } from "./base";
3
+ export { type ArrayConstraints, McpToolCompatibility, type ModelInfo, type ModelProvider, type NumberConstraints, type ObjectConstraints, type SchemaConstraints, type StringConstraints, } from "./base";
4
+ export { detectModelProvider };
5
+ export declare function createMcpToolCompatibility(runtime: IAgentRuntime): Promise<McpToolCompatibility | null>;
6
+ export declare function createMcpToolCompatibilitySync(runtime: IAgentRuntime): McpToolCompatibility | null;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tool-compatibility/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAExE,OAAO,EACL,KAAK,gBAAgB,EACrB,oBAAoB,EACpB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAmBtC;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,aAAa,GACrB,oBAAoB,GAAG,IAAI,CAmB7B"}
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Integration test for MCP Tool Compatibility System
4
+ * This test verifies that the tool compatibility is properly integrated
5
+ * into the McpService and automatically applies transformations.
6
+ */
7
+ declare function testIntegration(): Promise<void>;
8
+ declare function testServiceIntegration(): Promise<void>;
9
+ export { testIntegration, testServiceIntegration };
10
+ //# sourceMappingURL=integration-test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-test.d.ts","sourceRoot":"","sources":["../../../src/tool-compatibility/integration-test.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAuHH,iBAAe,eAAe,kBAoE7B;AAGD,iBAAe,sBAAsB,kBA4DpC;AAYD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC"}