Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions todo.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ Urgent:
- cancelling tasks
- AI asking follow up questions to a task

- only start and run MCP tools when actually called. This should include logic for the functions to be retrieved without it having to be ran.

Nice to have:
- voice mode
- API
Expand Down
8 changes: 5 additions & 3 deletions tools/AI/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@ async function generateGlobalPrompt(userId = 'default') {
const sortedTools = toolDescriptions.sort((a, b) => a.title.localeCompare(b.title));
let toolsList = sortedTools.map(tool => `> - ${tool.title}: ${tool.description}`).join('\n');

// Try to add MCP tools if available
// Try to add MCP tools if available (using lazy loading)
try {
const mcpModule = require('../mcp/main.js');
const mcpToolsInfo = await mcpModule.getMcpToolsForAI(userId);
const mcpToolsInfo = await mcpModule.getMcpToolsForAI(userId, false); // false = lazy loading

if (mcpToolsInfo.toolCount > 0) {
toolsList += '\n>\n> **MCP (Model Context Protocol) Tools:**\n';
toolsList += `> ${mcpToolsInfo.summary}\n>\n`;

for (const [serverName, tools] of Object.entries(mcpToolsInfo.availableTools)) {
tools.forEach(tool => {
toolsList += `> - ${tool.fullIdentifier}: ${tool.description} (via MCP server: ${serverName})\n`;
const status = tool.isStatic ? ' (static)' : ' (connected)';
toolsList += `> - ${tool.fullIdentifier}: ${tool.description} (via MCP server: ${serverName}${status})\n`;
});
}

toolsList += '>\n> **To use MCP tools:** Use the mcpClient tool with format: "Call tool [toolName] from [serverName] with args {...}"\n';
toolsList += '> **Note:** MCP tools use lazy loading - servers will only start when tools are actually called.\n';
}
} catch (error) {
// MCP not available or error loading - continue without MCP tools
Expand Down
Loading