Skip to content

Tool parameters use camelCase JSON names, breaking MCP clients that send snake_case #641

@drorh-st

Description

@drorh-st

Problem

When MCP clients (e.g. Claude Code) call tools like query_prometheus or list_loki_label_names, the parameters are silently ignored because the tool schemas define camelCase JSON field names (e.g. datasourceUid, startTime, queryType) while many MCP clients normalize parameter names to snake_case before sending them.

The result is that datasourceUid arrives as datasource_uid, doesn't match, defaults to empty string, and the server calls GET /api/datasources/uid/ with no UID — returning a 400 "id is invalid" error.

Steps to reproduce

Call query_prometheus with datasource_uid (snake_case) — the query fails with:

getting Prometheus client: get datasource by uid : [GET /datasources/uid/{uid}][400] getDataSourceByUidBadRequest {"message":"id is invalid"}

Calling the same tool manually with datasourceUid (camelCase) works correctly.

Environment

  • mcp-grafana: v0.11.2
  • Grafana: 12.3.3
  • MCP client: Claude Code 2.1.72

Expected behavior

Tool parameter names should use snake_case (e.g. datasource_uid, start_time, query_type) to be compatible with standard MCP client behavior, or the server should accept both naming conventions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions