Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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: {} } },
  • Input schema definition: accepts an empty object.
    inputSchema: { type: 'object', properties: {}
  • 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; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hlsitechio/mcp-instruct'

If you have feedback or need assistance with the MCP directory API, please join our Discord server