You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/04/07 20:44:23 UTC
(axis-axis2-c-core) 13/21: financial-benchmark: B1 — mcpInputSchema + MCP annotations for all 5 operations
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-c-core.git
commit 96391b602c9a4f9a52d694322010d52c224118c9
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Tue Apr 7 03:03:57 2026 -1000
financial-benchmark: B1 — mcpInputSchema + MCP annotations for all 5 operations
Populates Option 1 (static declaration) mcpInputSchema parameters for all
five FinancialBenchmarkService operations in services.xml:
- portfolioVariance: required [n_assets, weights, covariance_matrix]; typed
integer/array properties; normalize_weights boolean; request_id string
- monteCarlo: required [n_simulations, n_periods, initial_value,
expected_return, volatility]; range constraints; optional random_seed
- scenarioAnalysis: nested asset object schema with required sub-fields
(asset_id, current_price, scenario_prices, probabilities, position_size);
use_hash_lookup boolean
- metadata: empty properties (GET operation, no request body)
- generateTestData: single required n_assets integer
Each operation also gains mcpDescription (natural language), mcpReadOnly,
and mcpIdempotent parameters for MCP 2025-03-26 annotation hints.
These parameters are consumed by the D1 Axis2/C MCP catalog handler
(mcp_catalog_handler.c, forthcoming) via axis2_op_get_param().
Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
.../financial-benchmark-service/services.xml | 83 ++++++++++++++++++++++
1 file changed, 83 insertions(+)
diff --git a/samples/user_guide/financial-benchmark-service/services.xml b/samples/user_guide/financial-benchmark-service/services.xml
index 52202af02..30d671b01 100644
--- a/samples/user_guide/financial-benchmark-service/services.xml
+++ b/samples/user_guide/financial-benchmark-service/services.xml
@@ -78,6 +78,24 @@
Target: <10ms on old Android phone
================================================================ -->
<operation name="portfolioVariance">
+ <parameter name="mcpDescription">Calculate portfolio variance using an O(n²) covariance matrix. Returns portfolio volatility and annualised volatility. Benchmark: 500 assets in <10ms on constrained hardware.</parameter>
+ <parameter name="mcpReadOnly">true</parameter>
+ <parameter name="mcpIdempotent">true</parameter>
+ <parameter name="mcpInputSchema">{
+ "type": "object",
+ "required": ["n_assets", "weights", "covariance_matrix"],
+ "properties": {
+ "n_assets": {"type": "integer", "minimum": 2, "maximum": 2000,
+ "description": "Number of assets in the portfolio"},
+ "weights": {"type": "array", "items": {"type": "number"},
+ "description": "Portfolio weights, one per asset (will be normalised to sum=1)"},
+ "covariance_matrix": {"type": "array", "items": {"type": "number"},
+ "description": "Flattened n×n covariance matrix (row-major)"},
+ "normalize_weights": {"type": "boolean", "default": false,
+ "description": "Normalise weights before calculation"},
+ "request_id": {"type": "string", "description": "Optional correlation ID echoed in the response"}
+ }
+ }</parameter>
<description>
Calculate portfolio variance using covariance matrix multiplication.
@@ -126,6 +144,24 @@
Target: <500ms on old Android phone
================================================================ -->
<operation name="monteCarlo">
+ <parameter name="mcpDescription">Run a Monte Carlo VaR simulation using Geometric Brownian Motion. Compute-intensive: 10 000 sims × 252 periods = 2.52M iterations. Returns VaR 95/99, CVaR, max drawdown, and probability of profit.</parameter>
+ <parameter name="mcpReadOnly">true</parameter>
+ <parameter name="mcpIdempotent">true</parameter>
+ <parameter name="mcpInputSchema">{
+ "type": "object",
+ "required": ["n_simulations", "n_periods", "initial_value", "expected_return", "volatility"],
+ "properties": {
+ "n_simulations": {"type": "integer", "minimum": 100, "maximum": 1000000,
+ "description": "Number of simulation paths"},
+ "n_periods": {"type": "integer", "minimum": 1, "maximum": 2520,
+ "description": "Number of time steps (252 = 1 trading year)"},
+ "initial_value": {"type": "number", "description": "Initial portfolio value"},
+ "expected_return": {"type": "number", "description": "Annualised expected return (e.g. 0.08 for 8%)"},
+ "volatility": {"type": "number", "description": "Annualised volatility (e.g. 0.20 for 20%)"},
+ "random_seed": {"type": "integer", "description": "Optional seed for reproducible results"},
+ "request_id": {"type": "string", "description": "Optional correlation ID"}
+ }
+ }</parameter>
<description>
Run Monte Carlo simulation for Value at Risk calculation.
@@ -177,6 +213,35 @@
Mirrors DPT v2's fundAssetList.find() pattern.
================================================================ -->
<operation name="scenarioAnalysis">
+ <parameter name="mcpDescription">Scenario-weighted portfolio analysis using O(1) hash lookups vs O(n) linear search. Returns expected portfolio value and volatility across probability-weighted price scenarios.</parameter>
+ <parameter name="mcpReadOnly">true</parameter>
+ <parameter name="mcpIdempotent">true</parameter>
+ <parameter name="mcpInputSchema">{
+ "type": "object",
+ "required": ["n_assets", "assets"],
+ "properties": {
+ "n_assets": {"type": "integer", "minimum": 1, "maximum": 2000,
+ "description": "Number of assets"},
+ "assets": {"type": "array",
+ "description": "Array of asset scenario objects",
+ "items": {
+ "type": "object",
+ "required": ["asset_id", "current_price", "scenario_prices", "probabilities", "position_size"],
+ "properties": {
+ "asset_id": {"type": "integer"},
+ "current_price": {"type": "number"},
+ "scenario_prices":{"type": "array", "items": {"type": "number"},
+ "description": "Price in each scenario"},
+ "probabilities": {"type": "array", "items": {"type": "number"},
+ "description": "Probability weights (must sum to 1.0)"},
+ "position_size": {"type": "integer", "description": "Number of shares held"}
+ }
+ }},
+ "use_hash_lookup": {"type": "boolean", "default": true,
+ "description": "Use O(1) hash lookup instead of O(n) linear scan"},
+ "request_id": {"type": "string"}
+ }
+ }</parameter>
<description>
Calculate scenario-weighted portfolio analysis.
@@ -214,6 +279,13 @@
Get service information, capabilities, and device stats.
================================================================ -->
<operation name="metadata">
+ <parameter name="mcpDescription">Get FinancialBenchmarkService metadata: supported operations, capacity limits, current memory usage, and device platform information. No request body required.</parameter>
+ <parameter name="mcpReadOnly">true</parameter>
+ <parameter name="mcpIdempotent">true</parameter>
+ <parameter name="mcpInputSchema">{
+ "type": "object",
+ "properties": {}
+ }</parameter>
<description>
Get service metadata, capabilities, and current device statistics.
@@ -250,6 +322,17 @@
Generate synthetic test portfolio data for benchmarking.
================================================================ -->
<operation name="generateTestData">
+ <parameter name="mcpDescription">Generate a synthetic equal-weighted portfolio with a positive-semi-definite covariance matrix. Returns a ready-to-use portfolioVariance request body.</parameter>
+ <parameter name="mcpReadOnly">true</parameter>
+ <parameter name="mcpIdempotent">false</parameter>
+ <parameter name="mcpInputSchema">{
+ "type": "object",
+ "required": ["n_assets"],
+ "properties": {
+ "n_assets": {"type": "integer", "minimum": 2, "maximum": 2000,
+ "description": "Number of assets to generate"}
+ }
+ }</parameter>
<description>
Generate synthetic portfolio test data for benchmarking.