Conversation
…improvement # Conflicts: # packages/agent-toolkit/src/core/tools/platform-api-tools/list-workspace-tool/list-workspace-tool.test.ts # packages/agent-toolkit/src/core/tools/platform-api-tools/list-workspace-tool/list-workspace-tool.ts # packages/agent-toolkit/src/monday-graphql/schema.graphql
packages/agent-toolkit/src/core/tools/platform-api-tools/base-monday-api-tool.ts
Outdated
Show resolved
Hide resolved
...s/agent-toolkit/src/core/tools/platform-api-tools/list-workspace-tool/list-workspace-tool.ts
Outdated
Show resolved
Hide resolved
...s/agent-toolkit/src/core/tools/platform-api-tools/list-workspace-tool/list-workspace-tool.ts
Outdated
Show resolved
Hide resolved
...s/agent-toolkit/src/core/tools/platform-api-tools/list-workspace-tool/list-workspace-tool.ts
Outdated
Show resolved
Hide resolved
| let workspaces = filterNullWorkspaces(res); | ||
| let usedMemberOnly = true; | ||
|
|
||
| // If searching with a term and no matches found in member workspaces, try with all workspaces |
There was a problem hiding this comment.
Hey Shanee, can we include the comment that we don't allow "LLM filtering" at this point as it could cause the MCP to never search for all workspaces?
Cause initially I was surprised why we don't return those workspaces if the length is smaller than DEFAULT_WORKSPACE_LIMIT and comment here would be helpful for other devs
…orkspaces if no member workspaes are found
| .default(DEFAULT_WORKSPACE_LIMIT) | ||
| .describe(`The number of workspaces to return. Default and maximum allowed is ${DEFAULT_WORKSPACE_LIMIT}`), | ||
| page: z.number().min(1).default(1).describe('The page number to return. Default is 1.'), | ||
| .describe(`Number of workspaces to return. Default and max allowed is ${DEFAULT_WORKSPACE_LIMIT}`), |
There was a problem hiding this comment.
in general, why would we want the max to be the default, gives no insentive to use something else xD
There was a problem hiding this comment.
For accounts that don't have a large amount of workspaces we want to return 'as much as possible' to hopefully catch all of them, hence setting the default to max here however we do want to allow peple to lower it since the whole reasoning behind Damian's original limit here was to limit the # of workspaces returned to the context so it doesn't crash - not suree this will ever be used tho since it's not specified so I'll add a explanation
| }); | ||
|
|
||
| // First, try to get workspaces where the user is a member (more relevant results) | ||
| let res = await this.mondayApi.request<ListWorkspacesQueryResponse>( |
There was a problem hiding this comment.
its funny to me we are trying t create search logic here 😂
I wonder how good does it work, we dont have metric on the misses which is unfortunate here
if we have a lot of misses we just make doulbe api queries...
There was a problem hiding this comment.
Once the MCP is internal we can add logs for things like this :)
For now I guess our only option would be thru BB events
We can examine in BB or in your tracing tool how many times one user calls this tools multiple times right after the other
There was a problem hiding this comment.
its not about one tool one after the other, as this is two gql calls in the same tool call. we can trace it today I think anyway and check it but yeah looks...
.../agent-toolkit/src/core/tools/platform-api-tools/list-workspace-tool/list-workspace.types.ts
Outdated
Show resolved
Hide resolved
.../agent-toolkit/src/core/tools/platform-api-tools/list-workspace-tool/list-workspace.utils.ts
Show resolved
Hide resolved
…improvement # Conflicts: # packages/agent-toolkit/src/core/tools/platform-api-tools/get-board-items-page-tool/get-board-items-page-tool.ts # packages/agent-toolkit/src/monday-graphql/generated/graphql.dev/graphql.ts # packages/agent-toolkit/src/monday-graphql/generated/graphql/graphql.ts # packages/agent-toolkit/src/monday-graphql/schema.dev.graphql # packages/agent-toolkit/src/monday-graphql/schema.graphql
| .default(DEFAULT_WORKSPACE_LIMIT) | ||
| .describe(`The number of workspaces to return. Default and maximum allowed is ${DEFAULT_WORKSPACE_LIMIT}`), | ||
| page: z.number().min(1).default(1).describe('The page number to return. Default is 1.'), | ||
| .describe(`Number of workspaces to return. Set to max (${DEFAULT_WORKSPACE_LIMIT}) lower for smaller response size`), |
There was a problem hiding this comment.
I dont understand this sentence xD
| @@ -0,0 +1,3 @@ | |||
| export function hasElements<T>(arr: readonly T[] | null | undefined): arr is readonly T[] & { length: number } { | |||
There was a problem hiding this comment.
if you dont mind xD I think better name would have the array word in it just so itl be more redable in the code itself as we dont know by looking straight its from array utils
so something like arrayHasElements or arrayNotEmpty
|
|
||
| const shouldIncludeNoFilteringDisclaimer = searchTermNormalized && workspaces.length <= DEFAULT_WORKSPACE_LIMIT; | ||
| const filteredWorkspaces = this.filterWorkspacesIfNeeded(searchTermNormalized, workspaces, input); | ||
| // If the number of workspaces is small we prefer not filter and return all workspaces to LLM to filter |
There was a problem hiding this comment.
I understand its the same logic so just as fyi, I dont understand why would we want to pollute context in this scneario with more data, but I think this is the kind of query that will be removed if we ahve proper search
Actually I wonder, dont we get this from search? can we remove this tool???
There was a problem hiding this comment.
" // WORKSPACES = 'WORKSPACES', // already supported by list_workspaces tool"
I. wonder why cant we add this there instead?
| import { DEFAULT_WORKSPACE_LIMIT } from './list-workspace.consts'; | ||
| import { ListWorkspacesQuery } from '../../../../monday-graphql/generated/graphql/graphql'; | ||
|
|
||
| type Workspace = NonNullable<NonNullable<ListWorkspacesQuery['workspaces']>[number]>; |
https://monday.monday.com/boards/8222767873/views/175916623/pulses/10906328723
TLDR;
Using the new membershipKind enum to fetch first only the workspaces that I am a member of and then falling back to all if not found
Additional Small Changes