agent_get_active
Retrieve the currently active agent to maintain context and continuity in AI interactions across sessions.
Instructions
Get the currently active agent
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:940-971 (handler)The main handler for the agent_get_active MCP tool. It calls AgentManager.getActiveAgent() and formats the response as MCP content.case 'agent_get_active': { await am.initialize(); const activeAgent = am.getActiveAgent(); if (!activeAgent) { return { content: [ { type: 'text', text: 'No agent currently active. Use agent_activate to select one.' } ] }; } return { content: [ { type: 'text', text: JSON.stringify({ active: { id: activeAgent.id, name: activeAgent.name, category: activeAgent.metadata.category, role: activeAgent.metadata.role } }, null, 2) } ] }; }
- src/index.ts:378-385 (registration)Tool registration entry defining the name, description, and input schema (no parameters required). This is returned by listTools.{ name: 'agent_get_active', description: 'Get the currently active agent', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:381-383 (schema)Input schema definition: accepts an empty object.inputSchema: { type: 'object', properties: {}
- src/AgentManager.ts:125-130 (helper)Core helper method that retrieves the active AgentTemplate from the internal map using the stored activeAgent ID.getActiveAgent(): AgentTemplate | null { if (this.activeAgent) { return this.templates.get(this.activeAgent) || null; } return null; }