Skip to content

fix: add placeholder for MCP tool return type field #1970

Open
sharindanic wants to merge 2 commits into
wso2:mainfrom
sharindanic:fix/mcp-tool-return-type-placeholder
Open

fix: add placeholder for MCP tool return type field #1970
sharindanic wants to merge 2 commits into
wso2:mainfrom
sharindanic:fix/mcp-tool-return-type-placeholder

Conversation

@sharindanic

@sharindanic sharindanic commented Apr 12, 2026

Copy link
Copy Markdown

Purpose

Fixes wso2/product-integrator#731

The return type field in the MCP tool form was displaying undefined as placeholder text when a user adds a new
tool in the MCP service creator.

Goals

Show a meaningful placeholder for the return type field instead of undefined.

Approach

Added a placeholder property to the returnType field in McpToolForm/index.tsx that falls back to "e.g. string,
int, json" when no placeholder is defined in the metadata.

UI Component Development

N/A - No new UI components added

Manage Icons

N/A - No new icons added

User stories

N/A

Release note

Fixed undefined placeholder text in MCP tool return type field.

Documentation

N/A - Minor placeholder fix, no doc impact

Training

N/A

Certification

N/A

Marketing

N/A

Automation tests

N/A

Security checks

  • Followed secure coding standards? yes
  • Ran FindSecurityBugs plugin? N/A
  • No keys or secrets committed? yes

Samples

N/A

Related PRs

N/A

Migrations

N/A

Test environment

N/A

Learning

N/A

Summary by CodeRabbit

  • Improvements
    • The return type input now shows a contextual placeholder (falls back to an example like "e.g. string, int, json") to help users enter valid formats. The placeholder is driven by the form's underlying model so it reflects any available contextual guidance.

@CLAassistant

CLAassistant commented Apr 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5182fd59-3dc7-4385-ae5b-d7233c9104c6

📥 Commits

Reviewing files that changed from the base of the PR and between 8c5e9d9 and 6a26ca2.

📒 Files selected for processing (1)
  • workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/McpToolForm/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/McpToolForm/index.tsx

📝 Walkthrough

Walkthrough

The PR fixes the MCP tool form's return type placeholder by initializing it from model.returnType.placeholder, falling back to model.returnType.metadata?.placeholder, and finally to the literal "e.g. string, int, json" when prior values are missing.

Changes

Cohort / File(s) Summary
MCP Tool Form Field
workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/McpToolForm/index.tsx
Set returnType FormField placeholder to resolve from model.returnType.placeholder, then model.returnType.metadata?.placeholder, and default to "e.g. string, int, json".

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 I hopped through code both near and far,
Found a missing hint beneath a star,
I stitched a fallback, snug and sunny,
Now placeholders read clear and funny,
Hooray — no more "undefined" scar!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a placeholder for the MCP tool return type field.
Description check ✅ Passed The description addresses all required template sections with appropriate content, though some sections are marked N/A as they don't apply to this minor fix.
Linked Issues check ✅ Passed The code changes directly address the linked issue #731 by adding a meaningful placeholder to prevent 'undefined' from appearing in the return type field.
Out of Scope Changes check ✅ Passed All changes are scoped to the returnType field placeholder configuration in McpToolForm; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/McpToolForm/index.tsx`:
- Line 204: The placeholder lookup is using
model.returnType.metadata?.placeholder (which isn't defined) instead of the
top-level PropertyModel.placeholder; update the expression in the component to
prefer model.returnType.placeholder first, then fall back to
model.returnType.metadata?.placeholder (or the hardcoded default), so configured
placeholders on PropertyModel are honored—look for the usage of model.returnType
in the component (the placeholder prop at line with placeholder:
model.returnType.metadata?.placeholder || ...) and change it to check
model.returnType.placeholder before the metadata fallback.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2304a30b-0d38-451e-97bd-7698bb24acd6

📥 Commits

Reviewing files that changed from the base of the PR and between db77727 and 8c5e9d9.

📒 Files selected for processing (1)
  • workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/McpToolForm/index.tsx

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.

MCP service creator - Tool return type placeholder is undefined

2 participants