Skip to content

Conversation

@omeraplak
Copy link
Member

@omeraplak omeraplak commented Dec 27, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

What is the new behavior?

fixes (issue)

Notes for reviewers


Summary by cubic

Fixes empty-message MCP elicitations by deriving a prompt from the JSON Schema so handlers always receive a usable message. Prevents blank prompts when servers omit message.

  • Bug Fixes

    • If message is empty, fill it from requestedSchema.description; if missing, fall back to the first property’s description or title.
    • Added a unit test to ensure the derived message is passed to the elicitation handler.
  • New Features

    • Added a Go HTTP MCP server in the example that intentionally elicits with an empty message to verify the fallback.
    • Updated the example to connect to an external MCP server; README includes setup and run instructions.

Written for commit eee121b. Summary will update automatically on new commits.

@changeset-bot
Copy link

changeset-bot bot commented Dec 27, 2025

🦋 Changeset detected

Latest commit: eee121b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@voltagent/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@joggrbot

This comment has been minimized.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 8 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="examples/with-mcp-elicitation/src/index.ts">

<violation number="1" location="examples/with-mcp-elicitation/src/index.ts:13">
P2: Dead code: `startMcpServer(port, logger)` will never be called because `serverUrl` is hardcoded to a truthy string. The `||` fallback is unreachable. Either remove the fallback or use a conditional that can actually be falsy (e.g., uncomment the env var access).</violation>
</file>

Reply to cubic to teach it or ask questions. Tag @cubic-dev-ai to re-run a review.


const { url } = await startMcpServer(port, logger);
const serverUrl = "http://127.0.0.1:3142/mcp"; // process.env.MCP_SERVER_URL?.trim();
const resolvedUrl = serverUrl || (await startMcpServer(port, logger)).url;
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Dead code: startMcpServer(port, logger) will never be called because serverUrl is hardcoded to a truthy string. The || fallback is unreachable. Either remove the fallback or use a conditional that can actually be falsy (e.g., uncomment the env var access).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/with-mcp-elicitation/src/index.ts, line 13:

<comment>Dead code: `startMcpServer(port, logger)` will never be called because `serverUrl` is hardcoded to a truthy string. The `||` fallback is unreachable. Either remove the fallback or use a conditional that can actually be falsy (e.g., uncomment the env var access).</comment>

<file context>
@@ -9,14 +9,14 @@ const logger = createPinoLogger({
-
-const { url } = await startMcpServer(port, logger);
+const serverUrl = &quot;http://127.0.0.1:3142/mcp&quot;; // process.env.MCP_SERVER_URL?.trim();
+const resolvedUrl = serverUrl || (await startMcpServer(port, logger)).url;
 
 const mcpConfig = new MCPConfiguration({
</file context>
Fix with Cubic

@cloudflare-workers-and-pages
Copy link

Deploying voltagent with  Cloudflare Pages  Cloudflare Pages

Latest commit: eee121b
Status: ✅  Deploy successful!
Preview URL: https://2dddda92.voltagent.pages.dev
Branch Preview URL: https://bug-with-mcp-elicitation.voltagent.pages.dev

View logs

@omeraplak omeraplak merged commit f2a3ba8 into main Dec 27, 2025
22 checks passed
@omeraplak omeraplak deleted the bug/with-mcp-elicitation branch December 27, 2025 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants