@mytheo-my/portfolio 1.0.28 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +1 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -153,4 +153,4 @@ AI: [Calls tool with product_id="USDPORT", account_name="My Investment Account",
|
|
|
153
153
|
**Example 2 - Other Products:**
|
|
154
154
|
User: "I want the MYTHEO Global ESG portfolio"
|
|
155
155
|
AI: [Immediately calls tool with product_id="USDESGLGP" without asking for confirmation]
|
|
156
|
-
AI: "Great! I've created your MYTHEO Global ESG portfolio account. Here are the details: [shows account info]"`,inputSchema:{type:"object",properties:{product_id:{type:"string",description:"The product ID from list_available_products"},account_name:{type:"string",description:"Account name (required for USDPORT only)"},risk_tolerance:{type:"string",enum:["low","medium","high"],description:"Risk tolerance: low, medium, or high (USDPORT only)"},invest_duration:{type:"number",description:"Investment duration in years 1-30 (USDPORT only)"}},required:["product_id"]}},async e=>await this.handleCreatePortfolioAccount(e))}async handleToolCall(e,i){if(e==="list_available_products")return await this.handleListAvailableProducts(i);if(e==="create_portfolio_account")return await this.handleCreatePortfolioAccount(i);throw new Error(`Tool "${e}" not found`)}async handleListAvailableProducts(e){try{let i=e?.metadata;if(!i?.ciphertext)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"Metadata with ciphertext is required,
|
|
156
|
+
AI: "Great! I've created your MYTHEO Global ESG portfolio account. Here are the details: [shows account info]"`,inputSchema:{type:"object",properties:{product_id:{type:"string",description:"The product ID from list_available_products"},account_name:{type:"string",description:"Account name (required for USDPORT only)"},risk_tolerance:{type:"string",enum:["low","medium","high"],description:"Risk tolerance: low, medium, or high (USDPORT only)"},invest_duration:{type:"number",description:"Investment duration in years 1-30 (USDPORT only)"}},required:["product_id"]}},async e=>await this.handleCreatePortfolioAccount(e))}async handleToolCall(e,i){if(e==="list_available_products")return await this.handleListAvailableProducts(i);if(e==="create_portfolio_account")return await this.handleCreatePortfolioAccount(i);throw new Error(`Tool "${e}" not found`)}async handleListAvailableProducts(e){try{let i=e?.metadata;if(!i?.ciphertext)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"Metadata with ciphertext is required, Tell the user they do not have authorization to use this tool, and do not suggest anything to them at this point"},null,2)}]};let n;try{let s=this.encryption.decrypt(i.ciphertext);n=JSON.parse(s)}catch(s){return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:`Failed to decrypt metadata: ${s instanceof Error?s.message:"Unknown error"}. Tell the user they do not have authorization to use this tool, and do not suggest anything to them at this point`},null,2)}]}}if(!n.accessToken)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"Access token not found in metadata. Tell the user they do not have authorization to use this tool, and do not suggest anything to them at this point."},null,2)}]};let o=await Kr.getAvailableProducts();return{content:[{type:"text",text:JSON.stringify({success:!0,total_products:o.length,products:o},null,2)}]}}catch(i){let n=i instanceof Error?i.message:"Unknown error occurred";return{content:[{type:"text",text:JSON.stringify({error:"Failed to fetch products",message:n},null,2)}]}}}async handleCreatePortfolioAccount(e){let{product_id:i,account_name:n,risk_tolerance:o,invest_duration:s}=e;try{if(i==="USDPORT"){if(!n||!o||!s)return{content:[{type:"text",text:JSON.stringify({error:"Missing required parameters for USDPORT",message:"USDPORT requires account_name, risk_tolerance, and invest_duration",required_parameters:{account_name:'string (e.g., "My Investment Account")',risk_tolerance:"low | medium | high",invest_duration:"number between 1-30 years"}},null,2)}]};if(!["low","medium","high"].includes(o))return{content:[{type:"text",text:JSON.stringify({error:"Invalid risk_tolerance",message:`risk_tolerance must be 'low', 'medium', or 'high'. Received: ${o}`},null,2)}]};if(s<1||s>30)return{content:[{type:"text",text:JSON.stringify({error:"Invalid invest_duration",message:`invest_duration must be between 1 and 30 years. Received: ${s}`},null,2)}]}}let t=await Kr.createPortfolioAccount(i,n||void 0,o||void 0,s||void 0);return{content:[{type:"text",text:JSON.stringify({success:!0,message:"Portfolio account created successfully! Visit https://theo.silverlakedigitalinx.com/mytheoweb/home to check your portfolio",account_details:t},null,2)}]}}catch(t){let r=t instanceof Error?t.message:"Unknown error occurred";return{content:[{type:"text",text:JSON.stringify({error:"Failed to create portfolio account",message:r},null,2)}]}}}};var Yi=new za("portfolio");async function T6(){let a=process.argv.includes("--http")||process.env.MCP_TRANSPORT==="http"?"http":"stdio",e=process.env.PORT?parseInt(process.env.PORT,10):4e3;a==="http"?(Yi.info(`Starting Portfolio MCP server in HTTP mode on port ${e}...`),Yi.info("\u26A0\uFE0F HTTP mode requires the server to be running/hosted")):Yi.info("Starting Portfolio MCP server in stdio mode (no hosting required)...");try{await new jo(a,e).run()}catch(i){Yi.error("Failed to start Portfolio MCP server",i),process.exit(1)}}T6().catch(a=>{Yi.error("Unhandled error in main",a),process.exit(1)});
|