rowboat/apps/rowboat/app/lib/project_tools.ts
akhisud3195 9157f87dc7 Add hosted tools + revamp tools UX
Replace db storage with api calls to klavis for list servers and add filters to hosted tool views

Add logging and simplify oauth

Refactor klavis API calls to go via a proxy

Add projectAuthCheck() to klavis actions

Fix build error in stream-response route.ts

PARTIAL: Revamp tools modal

PARTIAL: Manage mcp servers at project level document

PARTIAL: Fetch tools from MCP servers upon toggle ON

PARTIAL: Propogate hosted MCP tools to entity_list in build view

Show tool toggle banner

Add sync explicitly to prevent long page load time for MCP server's tools

PARTIAL: Fix auth flow DB writes

PARTIAL: Add tools with isready flag for auth-related server handling

PARTIAL: Bring back sync tools CTA

Fix tool selection issues

PARTIAL: Fix sync issues with enriched and available tools and log unenriched tool names

Remove buggy log statement

Refactor common components and refactor HostedServer

PARTIAL: Add custom servers and standardize the UI

PARTIAL: Add modal and small UI improvements to custom servers page

Show clubbed MCP tools in entity_list

Add tool filters in tools section of entity_list

Revert text in add tool CTA

Make entity_list sections collapsed when one is expanded

Merge project level tools to workflow level tools when sending requests to agent service

Restore original panel-common variants

Reduce agentic workflow request by removing tools from mcp servers

Merge project level tools to workflow level tools when sending requests to copilot service

Fix padding issues in entity_list headers

Update package-lock.json

Revert package* files to devg

Revert tsconfig to dev

PARTIAL: Change tabs and switch to heroui pending switch issues

Fix switch issues with heroui

Pass projectTools via workflow/app to entity_list and do not write to DB

Fix issue with tool_config rendering and @ mentions for project tools

Include @ mentioned project tools in agent request

Update copilot usage of project tools

Read mcp server url directly from tool config in agents service

Make entity_list panels resizable

Update resize handlers across the board

Change Hosted MCP servers ---> Tools Library

Remove tools filter

Remove filter tabs in hosted tools

Move tools selected / tools available labels below card titles

Remove tools from config / settings page

Bring back old mcp servers handling in agents service for backward compatibility as fallback

Remove web_search from project template

Add icons for agents, tools and prompts in entity_list

Enable agents reordering in entity_list

Fix build errors

Make entity_list icons more transparent

Add logos for hosted tools and fix importsg

Fix server card component sizes and overflow

Add error handling in hosted servers pageg

Add node_modules to gitignore

remove root package json

add project auth checks

revert to project mcpServers being optional

refactor tool merging and conversion

revert stream route change

Move authURL klavis logic to klavis_actions

Fix tool enrichment for post-auth tools and make logging less verbose

Expand tool schema to include comprehensive json schema fields

Add enabled and ready filters to hosted tools

Add needs auth warning above auth button

Update tools icon

Add github and google client ids to docker-compose

Clean up MCP servers upon project deletion

Remove klavis ai label

Improve server loading on and off UX

Fix bug that was not enriching un-auth servers

Add tool testing capabilities

Fix un-blurred strip in tool testing modal view

Disable server card CTAs during toggling on or off transition

Add beta tag to tools

Add tool and server counts

Truncate long tool descriptions

Add separators between filters in servers view

Support multiple format types in tool testing fields

Fix menu position issue for @ mentions
2025-06-03 17:34:16 +05:30

51 lines
1.9 KiB
TypeScript

import { z } from "zod";
import { projectsCollection } from "./mongodb";
import { WorkflowTool } from "./types/workflow_types";
export async function fetchProjectMcpTools(projectId: string): Promise<z.infer<typeof WorkflowTool>[]> {
// Get project's MCP servers and their tools
const project = await projectsCollection.findOne({ _id: projectId });
if (!project?.mcpServers) return [];
console.log('[MCP] Getting tools from project:', {
serverCount: project.mcpServers.length,
servers: project.mcpServers.map(s => ({
name: s.name,
isReady: s.isReady,
toolCount: s.tools.length,
tools: s.tools.map(t => ({
name: t.name,
hasParams: !!t.parameters,
paramCount: t.parameters ? Object.keys(t.parameters.properties).length : 0,
required: t.parameters?.required || []
}))
}))
});
// Convert MCP tools to workflow tools format, but only from ready servers
const mcpTools = project.mcpServers
.filter(server => server.isReady) // Only include tools from ready servers
.flatMap(server => {
return server.tools.map(tool => ({
name: tool.name,
description: tool.description || "",
parameters: {
type: 'object' as const,
properties: tool.parameters?.properties || {},
required: tool.parameters?.required || []
},
isMcp: true,
mcpServerName: server.name,
mcpServerURL: server.serverUrl,
}));
});
console.log('[MCP] Converted tools from ready servers:', mcpTools.map(t => ({
name: t.name,
hasParams: !!t.parameters,
paramCount: t.parameters ? Object.keys(t.parameters.properties).length : 0,
required: t.parameters?.required || []
})));
return mcpTools;
}