@mytheo-my/portfolio 1.0.2 → 1.0.3
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 +2 -2
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
- It automatically handles authentication with the MYTHEO API
|
|
33
33
|
- Returns all products regardless of user criteria
|
|
34
34
|
- Present the products to the user in a clear, readable format
|
|
35
|
-
- Highlight key information: productid, productname, proddescp, and returnrate`,inputSchema:{access_token:Oe.z.string().optional().describe("Access token for authentication (passed by system, do not mention to user)")}},async(a={})=>{let{access_token:i}=a||{};try{if(!i)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"You are not allow to access this information."},null,2)}]};if(!this.config.API_KEY||this.config.API_KEY!==Xs)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"Invalid or missing API key. Please provide a valid API_KEY."},null,2)}]};let t=await mt.getAvailableProducts();return{content:[{type:"text",text:JSON.stringify({success:!0,total_products:t.length,products:t},null,2)}]}}catch(t){let n=t instanceof Error?t.message:"Unknown error occurred";return{content:[{type:"text",text:JSON.stringify({error:"Failed to fetch products",message:n},null,2)}]}}}),this.server.registerTool("create_portfolio_account",{title:"Create Portfolio Account",description:`Create a new portfolio account based on the selected product.
|
|
35
|
+
- Highlight key information: productid, productname, proddescp, and returnrate`,inputSchema:{access_token:Oe.z.string().nullable().optional().describe("Access token for authentication (passed by system, do not mention to user)")}},async(a={})=>{let{access_token:i}=a||{};try{if(!i)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"You are not allow to access this information."},null,2)}]};if(!this.config.API_KEY||this.config.API_KEY!==Xs)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"Invalid or missing API key. Please provide a valid API_KEY."},null,2)}]};let t=await mt.getAvailableProducts();return{content:[{type:"text",text:JSON.stringify({success:!0,total_products:t.length,products:t},null,2)}]}}catch(t){let n=t instanceof Error?t.message:"Unknown error occurred";return{content:[{type:"text",text:JSON.stringify({error:"Failed to fetch products",message:n},null,2)}]}}}),this.server.registerTool("create_portfolio_account",{title:"Create Portfolio Account",description:`Create a new portfolio account based on the selected product.
|
|
36
36
|
|
|
37
37
|
## What this tool does:
|
|
38
38
|
- Creates a portfolio account with MYTHEO based on user's product selection
|
|
@@ -91,4 +91,4 @@ AI: [Calls tool with product_id="USDPORT", account_name="My Investment Account",
|
|
|
91
91
|
**Example 2 - Other Products:**
|
|
92
92
|
User: "I want the MYTHEO Global ESG portfolio"
|
|
93
93
|
AI: [Immediately calls tool with product_id="USDESGLGP" without asking for confirmation]
|
|
94
|
-
AI: "Great! I've created your MYTHEO Global ESG portfolio account. Here are the details: [shows account info]"`,inputSchema:{product_id:Oe.z.string().describe("The product ID from list_available_products"),account_name:Oe.z.any().optional().describe("Account name (required for USDPORT only)"),risk_tolerance:Oe.z.any().optional().describe("Risk tolerance: low, medium, or high (USDPORT only)"),invest_duration:Oe.z.any().optional().describe("Investment duration in years 1-30 (USDPORT only)"),access_token:Oe.z.string().optional().describe("Access token for authentication (passed by system, do not mention to user)")}},async a=>{let{product_id:i,account_name:t,risk_tolerance:n,invest_duration:o,access_token:s}=a;try{if(console.log(s),!this.config.API_KEY||this.config.API_KEY!==Xs)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"Invalid or missing API key. Please provide a valid API_KEY."},null,2)}]};if(i==="USDPORT"){if(!t||!n||!o)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(n))return{content:[{type:"text",text:JSON.stringify({error:"Invalid risk_tolerance",message:`risk_tolerance must be 'low', 'medium', or 'high'. Received: ${n}`},null,2)}]};if(o<1||o>30)return{content:[{type:"text",text:JSON.stringify({error:"Invalid invest_duration",message:`invest_duration must be between 1 and 30 years. Received: ${o}`},null,2)}]}}let r=await mt.createPortfolioAccount(i,t||void 0,n||void 0,o||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:r},null,2)}]}}catch(r){let u=r instanceof Error?r.message:"Unknown error occurred";return{content:[{type:"text",text:JSON.stringify({error:"Failed to create portfolio account",message:u},null,2)}]}}})}setupErrorHandling(){process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)})}async run(){let a=new Zs.StdioServerTransport;await this.server.connect(a),this.logger.info("Portfolio MCP server running on stdio")}};var er=new Ke("portfolio");async function pu(){er.info("Starting Portfolio MCP server...");try{await new Ya().run()}catch(e){er.error("Failed to start Portfolio MCP server",e),process.exit(1)}}pu().then(e=>"");
|
|
94
|
+
AI: "Great! I've created your MYTHEO Global ESG portfolio account. Here are the details: [shows account info]"`,inputSchema:{product_id:Oe.z.string().describe("The product ID from list_available_products"),account_name:Oe.z.any().optional().describe("Account name (required for USDPORT only)"),risk_tolerance:Oe.z.any().optional().describe("Risk tolerance: low, medium, or high (USDPORT only)"),invest_duration:Oe.z.any().optional().describe("Investment duration in years 1-30 (USDPORT only)"),access_token:Oe.z.string().nullable().optional().describe("Access token for authentication (passed by system, do not mention to user)")}},async a=>{let{product_id:i,account_name:t,risk_tolerance:n,invest_duration:o,access_token:s}=a;try{if(console.log(s),!this.config.API_KEY||this.config.API_KEY!==Xs)return{content:[{type:"text",text:JSON.stringify({error:"Unauthorized",message:"Invalid or missing API key. Please provide a valid API_KEY."},null,2)}]};if(i==="USDPORT"){if(!t||!n||!o)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(n))return{content:[{type:"text",text:JSON.stringify({error:"Invalid risk_tolerance",message:`risk_tolerance must be 'low', 'medium', or 'high'. Received: ${n}`},null,2)}]};if(o<1||o>30)return{content:[{type:"text",text:JSON.stringify({error:"Invalid invest_duration",message:`invest_duration must be between 1 and 30 years. Received: ${o}`},null,2)}]}}let r=await mt.createPortfolioAccount(i,t||void 0,n||void 0,o||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:r},null,2)}]}}catch(r){let u=r instanceof Error?r.message:"Unknown error occurred";return{content:[{type:"text",text:JSON.stringify({error:"Failed to create portfolio account",message:u},null,2)}]}}})}setupErrorHandling(){process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)})}async run(){let a=new Zs.StdioServerTransport;await this.server.connect(a),this.logger.info("Portfolio MCP server running on stdio")}};var er=new Ke("portfolio");async function pu(){er.info("Starting Portfolio MCP server...");try{await new Ya().run()}catch(e){er.error("Failed to start Portfolio MCP server",e),process.exit(1)}}pu().then(e=>"");
|