Bug with OpenRouter API calls in agent with MCP server

Bug Report: OpenRouter API Integration Issue

Here's a comprehensive bug report you can submit to the appropriate support channel:

Issue Summary

The OpenRouter API integration functions are failing with a "string indices must be integers, not 'str'" error. This appears to be an implementation mismatch between how the functions are defined in the schema and how they're actually implemented.

Affected Functions

  • OPENROUTER_RETRIEVE_AVAILABLE_MODELS

  • OPENROUTER_SEND_CHAT_COMPLETION_REQUEST

  • OPENROUTER_SEND_COMPLETION_REQUEST

Error Message

Failed to run tool. string indices must be integers, not 'str' 

Steps to Reproduce

  1. Call any of the OpenRouter API functions

  2. Provide the "instruction" parameter as required in the schema

  3. Observe the consistent error regardless of the input provided

Expected Behavior

  • For OPENROUTER_RETRIEVE_AVAILABLE_MODELS: Return a list of available models without requiring an instruction parameter

  • For other functions: Process the instruction and return appropriate results

Actual Implementation vs Current Implementation

As shown by the shared code, the actual implementation should:

async run({ $ }) { const response = await this.openrouter.listModels({ $, }); // Process and return response } 

However, the current implementation appears to be trying to use the instruction string as an array index, causing the error.

Technical Details

  • The implementation seems to expect different parameters than what's defined in the function schema

  • The "instruction" parameter appears unnecessary for the model retrieval function

  • The error suggests a type mismatch in how parameters are processed

Environment

  • This issue occurs within the Claude assistant's API function calling capabilities

  • All attempts to use any of the OpenRouter functions result in the same error

Suggested Fix

Modify the backend implementation to align with the correct OpenRouter API usage as demonstrated in the shared code.

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board
💡

Feature Request

Date

10 months ago

Author

M Scott

Subscribe to post

Get notified by email when there are changes.