spring-projects / spring-projects/spring-ai
Support @Hidden on enums and object fields read by @MCPTool
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Expected Behavior
When adding @Hidden to enum values and fields of objects, the expected behavior is for Spring AI to filter those items from the generated tool inputSchema.
Current Behavior
At the moment, @MCPTool displays all enum values.
Context
The swagger annotation @Hidden is placed on enum values for example to avoid the OpenAPI spec from containing those values. The example below will generated an openapi.json file with currency: USD, CAD.
When viewing the generated tool definition of the below example, it contains all values "enum": ["EUR", "JPY", "USD", "CAD"] exposing fields/values that are not intended to be exposed.
enum Currency {
@Hidden EUR,
@Hidden JPY,
USD,
CAD
}
@RequireAuthentication
@GetMapping("{currency}")
@Operation(summary = GET_BALANCE_TITLE, description = GET_BALANCE_DESCRIPTION)
@McpTool(title = GET_BALANCE_TITLE, description = GET_BALANCE_DESCRIPTION)
public BalancePayload getBalance(@PathVariable final Currency currency) { ... }
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how @McpTool generates its inputSchema, especially enum values and object fields, and compare that path with the existing @Hidden behavior used for OpenAPI. Verify the generated tool schema excludes hidden enum values and fields while retaining visible ones.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100