feat(api): integrate MCP tools support in Ollama chat route
Add support for Model Context Protocol (MCP) tools in the Ollama chat API. Detect model capabilities to use native tools or prompt engineering. Handle tool calls, execute them via MCPExecutor, and inject results back into the conversation for seamless tool-assisted responses. This enhances chat functionality by enabling external tool integration.
This commit is contained in:
1 parent
745746afa9
commit
4739a13458
18 files changed
+1782
-10
No files matched your search
@@ -182,6 +182,38 @@ export class MCPRepository {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obter todos os MCPs instalados com informações completas (incluindo status, environment, etc)
|
||||
*/
|
||||
static getAllInstalled(): any[] {
|
||||
try {
|
||||
const stmt = db.prepare(`
|
||||
SELECT
|
||||
id, owner, repo, name, config, tools,
|
||||
status, status_message,
|
||||
environment_path, executable_command,
|
||||
validation_result, install_logs,
|
||||
installed_at, updated_at
|
||||
FROM mcp_installations
|
||||
ORDER BY installed_at DESC
|
||||
`);
|
||||
const results = stmt.all() as any[];
|
||||
|
||||
return results.map((row) => ({
|
||||
...row,
|
||||
config: row.config ? JSON.parse(row.config) : null,
|
||||
tools: row.tools ? JSON.parse(row.tools) : [],
|
||||
validation_result: row.validation_result
|
||||
? JSON.parse(row.validation_result)
|
||||
: null,
|
||||
install_logs: row.install_logs ? JSON.parse(row.install_logs) : [],
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error("Error getting all installed MCPs:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Atualizar timestamp de um MCP instalado
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user