ref-tools-mcp icon indicating copy to clipboard operation
ref-tools-mcp copied to clipboard

ref_read_url accepts invalid input types and missing required parameters

Open nofunction99 opened this issue 10 months ago • 3 comments

Summary

The ref_read_url tool does not validate its input parameters, allowing it to accept:

  1. Wrong types (e.g., {"url": 12345} instead of a string)
  2. Missing required parameters (e.g., {})

This violates the tool's own JSON schema which declares url as a required string parameter.

Steps to Reproduce

Call with wrong type (number instead of string) - tool accepts this without error: {"url": 12345}

Call with missing required parameter - tool accepts this without error: {}

Expected Behavior

The tool should reject invalid input with McpError using ErrorCode.InvalidParams, consistent with how prompts already validate their inputs in this codebase (e.g., lines 156-159).

Actual Behavior

The tool accepts the invalid input and passes it through to doRead(), which then fails downstream with a confusing error message.

Discovery

This issue was discovered using Bellwether, an MCP server validation tool. Bellwether's schema validation testing flagged that the tool accepts input that doesn't match its declared schema.

Bellwether validation output
Tool Type Checking Required Params
ref_read_url Fail (0/1) Fail (0/1)

Issues detected:

  • ref_read_url: Type coercion test: number for string "url"
  • ref_read_url: Missing required parameter test: missing all required arguments

Suggested Fix

I have a fix ready that adds validation following the existing pattern used for prompts. Happy to submit a PR if you'd like.

nofunction99 avatar Jan 26 '26 21:01 nofunction99

Hi @dotsetgreg thanks for reporting! That's an interesting tool you've built. Does it work with streamable-http servers?

Asking because this repo is legacy and basically only still exists for GitHub stars. I have a backlog item to clean it up a bit.

MatthewDailey avatar Jan 26 '26 22:01 MatthewDailey

Hi @MatthewDailey , thanks for the quick response! Yes, Bellwether fully supports streamable-http servers. If you want to use it, you can configure it in the bellwether.yaml file that's generated when using bellwether init in your project.

server:
  transport: streamable-http
  url: https://your-server-url/mcp
  timeout: 30000

Then run the bellwether check or bellwether explore commands as usual. The transport follows the MCP Streamable HTTP specification - it handles session ID management automatically (capturing Mcp-Session-Id from the server and including it in subsequent requests).

I just happened to test this with Bellwether after searching for a variety of MCP servers online and wanting to work on reducing false positive rates with the CLI. Feel free to test out Bellwether if you'd like! I'm improving on it rapidly so it's changing quite a bit, but I'd love to have some feedback about whether it's really useful and how to make it better. Thanks again!

nofunction99 avatar Jan 27 '26 01:01 nofunction99

Oh cool, if you want to test on Ref's streamable-http it's at api.ref.tools/mcp

To be completely honest, I probably won't test it myself since it's been in prod for a year and only changed the tool spec once maybe 7 months ago.

Definitely appreciate you building tools in the space!

MatthewDailey avatar Jan 27 '26 02:01 MatthewDailey