Skip to main content
Glama
query-agent.ts1.28 kB
import { createAction, Property } from '@activepieces/pieces-framework'; import { chaindeskAuth } from '../common/auth'; import { agentIdDropdown } from '../common/props'; import { AuthenticationType, httpClient, HttpMethod, } from '@activepieces/pieces-common'; import { BASE_URL } from '../common/constants'; export const queryAgentAction = createAction({ displayName: 'Query Agent', name: 'query-agent', auth: chaindeskAuth, description: 'Asks question to your Agent.', props: { agentId: agentIdDropdown, query: Property.LongText({ displayName: 'Query', required: true, }), conversationId: Property.LongText({ displayName: 'Conversation ID', required: false, description: 'ID of the conversation (If not provided a new conversation is created).', }), }, async run(context) { const { agentId, query, conversationId } = context.propsValue; const response = await httpClient.sendRequest({ method: HttpMethod.POST, url: BASE_URL + `/agents/${agentId}/query`, authentication: { type: AuthenticationType.BEARER_TOKEN, token: context.auth.secret_text, }, body: { query, conversationId, }, }); return response.body; }, });

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/activepieces/activepieces'

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