Browse Source

Add MCP tool to search asset profiles

pull/7849/head
Thomas Kaul 1 month ago
parent
commit
faec20835e
  1. 2
      apps/api/src/app/endpoints/mcp/mcp.controller.ts
  2. 20
      apps/api/src/app/endpoints/mcp/mcp.schemas.ts

2
apps/api/src/app/endpoints/mcp/mcp.controller.ts

@ -118,7 +118,7 @@ export class GhostfolioMcpController {
title: 'Search asset profiles'
},
description:
'Searches for asset profiles available to the user and gives import-ready candidates. Use this before importing an activity unless the exact symbol and data source are already known. Select the candidate that matches the intended asset and pass its symbol, dataSource and currency unchanged to import-activities.',
'Searches for financial assets, such as stocks, ETFs, cryptocurrencies, mutual funds and commodities, which are available to the user. Each result is an asset profile that can be used to import an activity. Use this before importing an activity unless the exact symbol and data source are already known. Select the candidate that matches the intended asset and pass its symbol, dataSource and currency unchanged to import-activities.',
name: 'search-asset-profiles',
parameters: SEARCH_ASSET_PROFILES_PARAMETERS
})

20
apps/api/src/app/endpoints/mcp/mcp.schemas.ts

@ -78,15 +78,6 @@ export const GET_ACTIVITIES_PARAMETERS = z.object({
.describe(`The number of activities to get, at most ${MCP_MAX_ACTIVITIES}`)
});
export const SEARCH_ASSET_PROFILES_PARAMETERS = z.object({
query: z
.string()
.trim()
.min(SEARCH_QUERY_MINIMUM_LENGTH)
.max(SEARCH_QUERY_MAXIMUM_LENGTH)
.describe('The name, symbol or ISIN of the asset profile to find')
});
export const IMPORT_ACTIVITIES_PARAMETERS = z.object({
activities: z
.array(
@ -124,3 +115,14 @@ export const IMPORT_ACTIVITIES_PARAMETERS = z.object({
.max(MCP_MAX_ACTIVITIES)
.describe(`The activities to import, at most ${MCP_MAX_ACTIVITIES}`)
});
export const SEARCH_ASSET_PROFILES_PARAMETERS = z.object({
query: z
.string()
.trim()
.min(SEARCH_QUERY_MINIMUM_LENGTH)
.max(SEARCH_QUERY_MAXIMUM_LENGTH)
.describe(
'The name, ticker symbol or ISIN of the financial asset, for example Apple, AAPL, Bitcoin or US0378331005'
)
});

Loading…
Cancel
Save