Browse Source

Add MCP tool to search asset profiles

pull/7849/head
Thomas Kaul 1 month ago
parent
commit
106f7c0737
  1. 12
      apps/api/src/app/endpoints/mcp/mcp.schemas.spec.ts
  2. 1
      apps/api/src/app/endpoints/mcp/mcp.schemas.ts

12
apps/api/src/app/endpoints/mcp/mcp.schemas.spec.ts

@ -55,6 +55,12 @@ describe('IMPORT_ACTIVITIES_PARAMETERS', () => {
});
describe('SEARCH_ASSET_PROFILES_PARAMETERS', () => {
it('Refuses a query that contains only spaces', () => {
expect(
SEARCH_ASSET_PROFILES_PARAMETERS.safeParse({ query: ' ' }).success
).toBe(false);
});
it(`Refuses a query shorter than ${SEARCH_QUERY_MINIMUM_LENGTH} characters`, () => {
expect(
SEARCH_ASSET_PROFILES_PARAMETERS.safeParse({ query: 'A' }).success
@ -76,4 +82,10 @@ describe('SEARCH_ASSET_PROFILES_PARAMETERS', () => {
).toBe(true);
}
});
it('Removes spaces at the start and the end of a query', () => {
expect(
SEARCH_ASSET_PROFILES_PARAMETERS.parse({ query: ' Apple ' }).query
).toBe('Apple');
});
});

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

@ -81,6 +81,7 @@ export const GET_ACTIVITIES_PARAMETERS = z.object({
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')

Loading…
Cancel
Save