Skip to content

[BUG] litellm.BadRequestError: OpenAIException - Invalid schema for function 'series': In context=('properties', 'matches'), array schema missing items. #711

@zebesh

Description

@zebesh

📋 Prerequisites

  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow our Code of Conduct
  • I am using the latest version of the software
  • I have tried to clear cache/cookies or used incognito mode (if ui-related)
  • I can consistently reproduce this issue

🎯 Affected Service(s)

App Service

🚦 Impact/Severity

No impact (Default)

🐛 Bug Description

i install this mcp server https://github.com/tjhop/prometheus-mcp-server/tree/main like this:
`apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus-mcp-server
namespace: kagent
labels:
app: prometheus-mcp-server
spec:
replicas: 1
selector:
matchLabels:
app: prometheus-mcp-server
template:
metadata:
labels:
app: prometheus-mcp-server
spec:
containers:
- name: prometheus-mcp-server
image: ghcr.io/tjhop/prometheus-mcp-server:v0.3.0
imagePullPolicy: IfNotPresent
args:
[
"--log.file",
"/dev/stdout",
"--log.level",
"debug",
"--mcp.transport",
"http",
"--prometheus.url",
"http://kube-prometheus-stack-prometheus.kube-prometheus-stack.svc.cluster.local:9090",
]
ports:
- containerPort: 8080
resources:
limits:
cpu: "500m"
memory: "256Mi"
requests:
cpu: "10m"
memory: "64Mi"

apiVersion: v1
kind: Service
metadata:
name: prometheus-mcp-server
spec:
selector:
app: prometheus-mcp-server
ports:
- port: 80
targetPort: 8080
type: ClusterIP
`

after add toolserver
apiVersion: kagent.dev/v1alpha1 kind: ToolServer metadata: name: prometheus spec: config: streamableHttp: sseReadTimeout: 5m0s timeout: 5s url: http://prometheus-mcp-server:80/mcp type: streamableHttp description: 'Prometheus MCP Server for metrics and monitoring data'

and after create agent
`apiVersion: kagent.dev/v1alpha1
kind: Agent
metadata:
name: prometheus
spec:
description: агент для работы с прометеем
memory:
- kagent/kagent-memory
modelConfig: default-model-config
systemMessage: |-
You're a helpful agent, made by the kagent team.

# Instructions
    - If user question is unclear, ask for clarification before running any tools
    - Always be helpful and friendly
    - If you don't know how to answer the question DO NOT make things up, tell the user "Sorry, I don't know how to answer that" and ask them to clarify the question further
    - If you are unable to help, or something goes wrong, refer the user to https://kagent.dev for more information or support.

# Response format:
    - ALWAYS format your response as Markdown
    - Your response will include a summary of actions you took and an explanation of the result
    - If you created any artifacts such as files or resources, you will include those in your response as well

tools:
- mcpServer:
toolNames:
- exemplar_query
- list_alerts
- list_targets
- metric_metadata
- query
- range_query
- series
- targets_metadata
- alertmanagers
toolServer: kagent/prometheus
type: McpServer
`

and then i ask anything i get error
litellm.BadRequestError: OpenAIException - Invalid schema for function 'series': In context=('properties', 'matches'), array schema missing items.

🔄 Steps To Reproduce

  1. install mcp
  2. create tools server
  3. create agent
  4. ask somthing

🤔 Expected Behavior

No response

📱 Actual Behavior

No response

💻 Environment

No response

🔧 CLI Bug Report

No response

🔍 Additional Context

No response

📋 Logs

litellm.llms.openai.common_utils.OpenAIError: Error code: 400 - {'error': {'message': "Invalid schema for function 'series': In context=('properties', 'matches'), array schema missing items.", 'type': 'invalid_request_error', 'param': 'tools[7].function.parameters', 'code': 'invalid_function_parameters'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/python/packages/kagent-adk/src/kagent_adk/_agent_executor.py", line 124, in execute
    await self._handle_request(context, event_queue, runner)
  File "/app/python/packages/kagent-adk/src/kagent_adk/_agent_executor.py", line 188, in _handle_request
    async for adk_event in runner.run_async(**run_args):
    ...<4 lines>...
            await event_queue.enqueue_event(a2a_event)
  File "/app/python/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 233, in run_async
    async for event in self._exec_with_plugin(
    ...<2 lines>...
      yield event
  File "/app/python/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 274, in _exec_with_plugin
    async for event in execute_fn(invocation_context):
    ...<6 lines>...
      yield (modified_event if modified_event else event)
  File "/app/python/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 230, in execute

📷 Screenshots

No response

🙋 Are you willing to contribute?

  • I am willing to submit a PR to fix this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions