A Spring Boot-based MCP server framework supporting multiple MCP endpoints with security, JWT/JWE encryption, and dynamic tool registration via annotations
The Multi MCP Server provides two tools with minimal schema documentation and missing parameter descriptions. Tool definitions are registered via Spring AI's ToolCallbacks introspection mechanism, making explicit schema validation difficult from the source code alone. Both tools have extremely brief descriptions (under 50 chars), lack parameter type constraints, and provide no output schema documentation. The architecture relies on MethodToolCallback delegation, which means tool definitions are inferred from method signatures rather than explicitly declared. This is a foundational issue that cascades through naming, parameter clarity, and error handling. No tools feature rich descriptions that explain WHEN to use them or what format values should take. The server implements basic HTTP transport but lacks critical quality patterns like pagination, error recovery guidance, and structured output schemas.
Tool descriptions are critically brief (under 50 characters each). 'Lookup current weather for a city' and 'Get stock price alert for ticker' lack context about WHEN to use these tools, what format inputs should take, and what structure is returned. LLMs cannot reliably select or invoke these tools with such sparse documentation.
Input parameter 'city' in weather_lookup and 'ticker' in stocks_alert have descriptions ('City name to lookup weather for', 'Stock ticker symbol') but no visible type constraints, enums, or format specifications. No indication of valid formats (e.g., 'ticker must be 1-5 uppercase letters' or 'city must be full name, not abbreviation'). The rubric requires actionable parameter constraints, current descriptions are too vague.
No output schema is documented for either tool. LLMs do not know what fields to expect in responses, preventing reliable downstream tool chaining and data extraction. A response might return {temperature: 72, city: 'Boston'} or {temp_f: 72, city_name: 'Boston', units: 'F', timestamp: ...}, without documentation, LLMs guess.
Recommendations
Expand tool descriptions to 100-200 characters. Include WHAT the tool does, WHEN to use it (e.g., 'Use this when the user asks about current conditions in a specific city'), and WHAT it returns (e.g., 'Returns temperature, conditions, and humidity'). Example: 'Get real-time weather for a city. Use this when the user asks about current conditions, forecasts, or weather alerts. Returns temperature in Fahrenheit, description (clear/cloudy/rainy), and humidity percentage.'
Add explicit enum/pattern constraints to parameters. For 'ticker', add: 'Stock ticker symbol (1-5 uppercase letters, e.g. AAPL, MSFT, BRK.B)'. For 'city', add: 'Full city name, optionally with 2-letter state/country code (e.g. Boston, MA or London, UK). Ambiguous or invalid city names will return an error suggesting available matches.'
Document output schemas explicitly. Create a schema definition (or at minimum add to the tool description) specifying: 'Returns {weather: {temperature: number (°F), description: string, humidity: number (0-100)}, location: {city: string, state_or_country: string}, timestamp: ISO8601 string}'
Implement complete error handling with recovery guidance. For weather_lookup: 'If city is not found, the tool returns a list of similar city names. Use one of those and retry. If the weather service is unavailable (rare), wait 60 seconds and retry.' Document all failure modes and their remediation in the tool description or a separate error handling guide.
Fix the incomplete SecuredMethodToolCallback implementation. Either complete the permission check logic or remove the class. As written, call() returns null, which will cause tool invocations to fail silently or crash. Implement actual authorization logic: 'if (user lacks permission) return error("User lacks permission:read:weather"); else return delegate.call(toolInput);'
Tool definitions are inferred from Spring AI MethodToolCallback reflection (McpToolUtils.toSyncToolSpecifications), not explicitly declared in code. The actual schema objects are not visible in the provided source. Without seeing explicit ToolDefinition registration with full JSON Schema, schema completeness cannot be verified. This violates the principle of explicit over implicit for tool contracts.
No error handling guidance. If weather_lookup fails (invalid city, API timeout, rate limit), there is no documentation of what error messages the LLM will receive, how to classify them (retryable vs user-fixable), or what recovery actions to take. Agents will be blind to failure modes.
Tool naming 'stocks_alert' is ambiguous. Does it GET the alert, CREATE an alert, UPDATE an alert, or LIST alerts? The verb 'alert' is a noun, not an action. Should be 'get_stock_alert', 'create_price_alert', 'list_stock_alerts', or similar. Current name lacks the action verb required by the rubric.
SecuredMethodToolCallback.java contains a delegating call() method that returns null (line 'return null;') with a comment 'delegate / return proxyDelegate.call(args);'. This is incomplete implementation, the secured tool callback does not actually invoke the underlying tool. Production code should not commit incomplete security proxies.
weather_lookupstocks_alert
Rename 'stocks_alert' to a verb_noun pattern. Clarify the action: is it 'get_stock_price', 'check_stock_alert', or 'create_price_alert'? Review the actual implementation to determine the correct verb and rename accordingly.
Add pagination support if tools can return multiple results. E.g., if weather_lookup can accept a list of cities and return conditions for each, add: 'max_results: 10 (default), offset: 0 for pagination. Returns total_count so the agent can fetch pages if needed.'
Document tool idempotence explicitly. 'This tool is read-only and idempotent, calling it multiple times with the same city will always return the current weather. It is safe to retry if the connection fails.'
Add rate-limit and timeout guidance to descriptions. E.g., 'Rate limit: 100 calls per minute per IP. Timeout: 5 seconds. If rate limited, the error message will indicate retry-after duration. If timeout occurs, the external weather service may be slow, wait and retry.'
Make parameter descriptions more specific and actionable. Current: 'City name to lookup weather for'. Better: 'Full city name (e.g., Boston, not Boston, MA). If the city name is ambiguous, the tool returns a list of matches with their state/country. For unambiguous cities, prefer full name over abbreviation, New York, not NY.'
Document what data the tools actually call. E.g., 'This tool queries the OpenWeatherMap API. Updates occur every 10 minutes. Historical data is not available, only current conditions.' This sets expectations about staleness and limitations.
For stocks_alert, clarify: is this a polling tool (returns current price) or a subscription tool (creates an alert you check later)? The name suggests the latter, the description the former. Rename and document the actual behavior.