This is an automated email from the ASF dual-hosted git repository. robertlazarski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git
commit 50ce10b76340fbbc9b70a2a900ffa2915778121c Author: Robert Lazarski <[email protected]> AuthorDate: Wed Apr 8 16:51:57 2026 -1000 Add mcpInputSchema to all service operations for MCP tool discovery Populate inputSchema in /openapi-mcp.json so AI agents (Claude, Annie) can construct valid requests from natural language without documentation. - portfolioVariance: 7 properties (nAssets, weights, covarianceMatrix, covarianceMatrixFlat, normalizeWeights, nPeriodsPerYear, requestId) - monteCarlo: 9 properties with defaults (all optional — empty {} valid) - scenarioAnalysis: 4 properties with nested asset/scenario schema - doLogin: 2 required properties (email, credentials), mcpRequiresAuth=false - processBigDataSet: 2 required properties (datasetId, datasetSize) Schemas are declared as mcpInputSchema parameters in services.xml and parsed by OpenApiSpecGenerator.generateMcpCatalogJson() at runtime. Verified on local WildFly 32 and stg-rapi02 staging. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --- .../bigdata_h2_resources/services.xml | 9 ++++ .../finbench_resources/services.xml | 56 ++++++++++++++++++++++ .../resources-axis2/login_resources/services.xml | 10 ++++ 3 files changed, 75 insertions(+) diff --git a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/bigdata_h2_resources/services.xml b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/bigdata_h2_resources/services.xml index 33f33da246..64508f0753 100644 --- a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/bigdata_h2_resources/services.xml +++ b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/bigdata_h2_resources/services.xml @@ -75,6 +75,15 @@ - Multiplexing for 10-50MB datasets - Standard for <10MB datasets </description> + <parameter name="mcpDescription">Process large JSON datasets with HTTP/2 streaming optimization. Automatically selects processing mode based on dataset size. Returns processing metrics including throughput, memory usage, and transport statistics.</parameter> + <parameter name="mcpInputSchema">{ + "type": "object", + "required": ["datasetId", "datasetSize"], + "properties": { + "datasetId": {"type": "string", "description": "Unique dataset identifier for tracking"}, + "datasetSize": {"type": "integer", "description": "Dataset size in bytes (determines processing mode: streaming for 50MB+, multiplexing for 10-50MB, standard for <10MB)"} + } + }</parameter> <!-- HTTP/2 Operation Configuration --> <parameter name="enableHTTP2Streaming">true</parameter> diff --git a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/finbench_resources/services.xml b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/finbench_resources/services.xml index 23531be0b8..167ea08f55 100644 --- a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/finbench_resources/services.xml +++ b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/finbench_resources/services.xml @@ -27,6 +27,20 @@ <parameter name="enableJSONOnly">true</parameter> <parameter name="disableSOAP">true</parameter> <operation name="portfolioVariance"> + <parameter name="mcpDescription">Calculate portfolio variance using O(n²) covariance matrix multiplication. Returns variance, volatility, annualized volatility. Supports up to 2000 assets with optional weight normalization and custom annualization periods (252 for equity, 365 for crypto, 12 for monthly).</parameter> + <parameter name="mcpInputSchema">{ + "type": "object", + "required": ["nAssets", "weights", "covarianceMatrix"], + "properties": { + "nAssets": {"type": "integer", "minimum": 2, "maximum": 2000, "description": "Number of assets in the portfolio"}, + "weights": {"type": "array", "items": {"type": "number"}, "description": "Portfolio weights. Must sum to 1.0 unless normalizeWeights=true"}, + "covarianceMatrix": {"type": "array", "items": {"type": "array", "items": {"type": "number"}}, "description": "n×n covariance matrix (2D array)"}, + "covarianceMatrixFlat": {"type": "array", "items": {"type": "number"}, "description": "Alternative: flattened n×n covariance matrix (row-major, length = nAssets²)"}, + "normalizeWeights": {"type": "boolean", "default": false, "description": "Rescale weights to sum to 1.0"}, + "nPeriodsPerYear": {"type": "integer", "default": 252, "description": "Trading periods for annualizing. 252=equity, 365=crypto, 12=monthly"}, + "requestId": {"type": "string", "description": "Optional request ID echoed in response for tracing"} + } + }</parameter> <messageReceivers> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.json.moshi.rpc.JsonRpcMessageReceiver"/> @@ -35,6 +49,22 @@ </messageReceivers> </operation> <operation name="monteCarlo"> + <parameter name="mcpDescription">Monte Carlo VaR simulation using Geometric Brownian Motion. Returns VaR at caller-specified percentiles, CVaR (expected shortfall), max drawdown, probability of profit, and throughput metrics. All parameters have sensible defaults — an empty request body is valid.</parameter> + <parameter name="mcpInputSchema">{ + "type": "object", + "required": [], + "properties": { + "nSimulations": {"type": "integer", "default": 10000, "maximum": 1000000, "description": "Number of simulation paths (max 1M)"}, + "nPeriods": {"type": "integer", "default": 252, "description": "Time steps per path (252 = 1 trading year)"}, + "initialValue": {"type": "number", "default": 1000000, "description": "Starting portfolio value in currency units"}, + "expectedReturn": {"type": "number", "default": 0.08, "description": "Annualized expected return (0.08 = 8%)"}, + "volatility": {"type": "number", "default": 0.20, "description": "Annualized volatility (0.20 = 20%)"}, + "randomSeed": {"type": "integer", "default": 0, "description": "RNG seed for reproducibility. 0 = non-deterministic"}, + "nPeriodsPerYear": {"type": "integer", "default": 252, "description": "Periods per year for GBM dt calculation"}, + "percentiles": {"type": "array", "items": {"type": "number"}, "default": [0.01, 0.05], "description": "VaR percentiles, e.g. [0.01, 0.05] for 99% and 95%"}, + "requestId": {"type": "string", "description": "Optional request ID echoed in response"} + } + }</parameter> <messageReceivers> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.json.moshi.rpc.JsonRpcMessageReceiver"/> @@ -43,6 +73,32 @@ </messageReceivers> </operation> <operation name="scenarioAnalysis"> + <parameter name="mcpDescription">Probability-weighted scenario analysis with hash table vs linear scan benchmarking. Computes expected return, upside potential, downside risk across user-defined price scenarios per asset.</parameter> + <parameter name="mcpInputSchema">{ + "type": "object", + "required": ["assets"], + "properties": { + "assets": {"type": "array", "description": "Portfolio assets with scenario prices and probabilities", "items": { + "type": "object", + "required": ["assetId", "currentPrice", "positionSize", "scenarios"], + "properties": { + "assetId": {"type": "integer", "description": "Unique asset identifier"}, + "currentPrice": {"type": "number", "description": "Current market price (must be > 0)"}, + "positionSize": {"type": "number", "description": "Number of shares/units held"}, + "scenarios": {"type": "array", "description": "Price scenarios with probabilities (must sum to 1.0)", "items": { + "type": "object", + "properties": { + "price": {"type": "number", "description": "Scenario price"}, + "probability": {"type": "number", "description": "Scenario probability (0-1)"} + } + }} + } + }}, + "useHashLookup": {"type": "boolean", "default": true, "description": "Use HashMap for O(1) lookups vs ArrayList O(n) scan"}, + "probTolerance": {"type": "number", "default": 0.0001, "description": "Tolerance for probability sum validation"}, + "requestId": {"type": "string", "description": "Optional request ID echoed in response"} + } + }</parameter> <messageReceivers> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.json.moshi.rpc.JsonRpcMessageReceiver"/> diff --git a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/login_resources/services.xml b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/login_resources/services.xml index 64812c7c96..c3ba3f1be2 100755 --- a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/login_resources/services.xml +++ b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/resources-axis2/login_resources/services.xml @@ -23,6 +23,16 @@ <parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter> <parameter name="SpringBeanName">loginService</parameter> <operation name="doLogin"> + <parameter name="mcpDescription">Authenticate and obtain a JWT Bearer token. The token is required in the Authorization header for all subsequent service calls.</parameter> + <parameter name="mcpRequiresAuth">false</parameter> + <parameter name="mcpInputSchema">{ + "type": "object", + "required": ["email", "credentials"], + "properties": { + "email": {"type": "string", "description": "User email address"}, + "credentials": {"type": "string", "description": "User password"} + } + }</parameter> <messageReceivers> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.json.moshi.rpc.JsonRpcMessageReceiver" />
