/**
* MCP Tool Definitions
*
* Defines the tools available to MCP clients for interacting with Councly.
*/
import { z } from 'zod';
/**
* Tool schemas for validation
*/
export const counclyHearingSchema = z.object({
subject: z.string().min(10).max(10000).describe(
'The topic or question to discuss. Should be clear and specific. For code review, include the code. For decisions, include context and constraints.'
),
preset: z.enum(['balanced', 'fast', 'coding', 'coding_plus']).optional().default('balanced').describe(
'Model preset to use. balanced (9 credits) - general purpose, fast (6 credits) - quick responses, coding (14 credits) - code-focused, coding_plus (17 credits) - enhanced with 4 counsels'
),
workflow: z.enum(['auto', 'discussion', 'review', 'brainstorming']).optional().default('auto').describe(
'Workflow type. auto - system chooses best fit, discussion - debate format, review - code/document review, brainstorming - idea generation'
),
wait: z.boolean().optional().default(true).describe(
'Whether to wait for completion. If true, polls until hearing finishes. If false, returns immediately with hearing ID.'
),
timeout_seconds: z.number().min(30).max(600).optional().default(300).describe(
'Maximum seconds to wait for completion (only used if wait=true). Default 300 (5 minutes).'
),
});
export const counclyStatusSchema = z.object({
hearing_id: z.string().uuid().describe('The hearing ID returned from councly_hearing'),
});
export type CounclyHearingInput = z.infer<typeof counclyHearingSchema>;
export type CounclyStatusInput = z.infer<typeof counclyStatusSchema>;
/**
* Tool definitions for MCP server
*/
export const TOOL_DEFINITIONS = [
{
name: 'councly_hearing',
description: `Create a council hearing where multiple LLMs (Claude, GPT, Gemini, Grok) debate a topic and a moderator synthesizes the verdict.
Use cases:
- Code review: Get diverse perspectives on code quality, architecture, security
- Technical decisions: Compare approaches, weigh trade-offs
- Problem solving: Generate and evaluate multiple solutions
- Brainstorming: Explore ideas from different angles
The hearing runs asynchronously. By default, this tool waits for completion and returns the verdict. Set wait=false to get the hearing ID immediately and check status later with councly_status.
Cost: Varies by preset (6-17 credits). Check councly.ai for current pricing.`,
inputSchema: {
type: 'object',
properties: {
subject: {
type: 'string',
description: 'The topic or question to discuss. Be specific and include relevant context.',
minLength: 10,
maxLength: 10000,
},
preset: {
type: 'string',
enum: ['balanced', 'fast', 'coding', 'coding_plus'],
default: 'balanced',
description: 'Model preset: balanced (9 credits), fast (6 credits), coding (14 credits), coding_plus (17 credits, 4 counsels)',
},
workflow: {
type: 'string',
enum: ['auto', 'discussion', 'review', 'brainstorming'],
default: 'auto',
description: 'Workflow type for the hearing',
},
wait: {
type: 'boolean',
default: true,
description: 'Wait for completion (true) or return immediately (false)',
},
timeout_seconds: {
type: 'number',
default: 300,
minimum: 30,
maximum: 600,
description: 'Max wait time in seconds (if wait=true)',
},
},
required: ['subject'],
},
},
{
name: 'councly_status',
description: `Check the status of a council hearing.
Returns:
- For in-progress hearings: current phase and progress percentage
- For completed hearings: verdict, trust score, and counsel summaries
- For failed hearings: error message
Use this to check on hearings created with wait=false, or to retrieve past hearing results.`,
inputSchema: {
type: 'object',
properties: {
hearing_id: {
type: 'string',
format: 'uuid',
description: 'The hearing ID to check',
},
},
required: ['hearing_id'],
},
},
];