get_idea
Retrieve detailed information about an idea by its ID, including current support and pass counts to see what other players think.
Instructions
Fetch full detail on one idea by id, including current support / pass counts (so the agent can see what other players think).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The idea id (uuid). |
Implementation Reference
- src/index.ts:127-189 (handler)The async handler for the 'get_idea' tool. Fetches full idea details (title, description, category, media, deadlines, resolution criteria, verification info, result) from the 'ideas' table and support/pass counts from the 'idea_support_counts' view, then returns them as JSON.
async ({ id }) => { const [ideaRes, countsRes] = await Promise.all([ sb .from('ideas') .select( 'id,title,one_liner,description,category,media_url,' + 'lock_at,resolve_at,resolution_criteria,verification_source_type,' + 'verification_ref,result', ) .eq('id', id) .eq('status', 'approved') .maybeSingle(), sb .from('idea_support_counts') .select('support_count,pass_count') .eq('idea_id', id) .maybeSingle(), ]); if (ideaRes.error) { return { content: [{ type: 'text', text: `error: ${ideaRes.error.message}` }], isError: true, }; } if (!ideaRes.data) { return { content: [{ type: 'text', text: `not found or not approved: ${id}` }], isError: true, }; } // Supabase's inferred row types are noisy without a generated schema; // cast through unknown to a local shape to keep the rest of the code clean. const idea = ideaRes.data as unknown as { id: string; title: string; one_liner: string; description: string; category: string; media_url: string; lock_at: string; resolve_at: string; resolution_criteria: string | null; verification_source_type: string | null; verification_ref: unknown; result: 'success' | 'fail' | null; }; const counts = countsRes.data as unknown as | { support_count: number; pass_count: number } | null; const payload = { id: idea.id, title: idea.title, oneLiner: idea.one_liner, description: idea.description, category: idea.category, mediaUrl: idea.media_url, lockAt: idea.lock_at, resolveAt: idea.resolve_at, resolutionCriteria: idea.resolution_criteria, verificationSourceType: idea.verification_source_type, verificationRef: idea.verification_ref, result: idea.result, supportCount: counts?.support_count ?? 0, passCount: counts?.pass_count ?? 0, }; return { content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }], }; }, - src/index.ts:123-125 (schema)Input schema for 'get_idea' — requires a single 'id' parameter of type UUID string.
inputSchema: { id: z.string().uuid().describe('The idea id (uuid).'), }, - src/index.ts:117-190 (registration)Registration of the 'get_idea' tool on the MCP server via server.registerTool() with its description, input schema, and handler.
server.registerTool( 'get_idea', { description: 'Fetch full detail on one idea by id, including current support / ' + 'pass counts (so the agent can see what other players think).', inputSchema: { id: z.string().uuid().describe('The idea id (uuid).'), }, }, async ({ id }) => { const [ideaRes, countsRes] = await Promise.all([ sb .from('ideas') .select( 'id,title,one_liner,description,category,media_url,' + 'lock_at,resolve_at,resolution_criteria,verification_source_type,' + 'verification_ref,result', ) .eq('id', id) .eq('status', 'approved') .maybeSingle(), sb .from('idea_support_counts') .select('support_count,pass_count') .eq('idea_id', id) .maybeSingle(), ]); if (ideaRes.error) { return { content: [{ type: 'text', text: `error: ${ideaRes.error.message}` }], isError: true, }; } if (!ideaRes.data) { return { content: [{ type: 'text', text: `not found or not approved: ${id}` }], isError: true, }; } // Supabase's inferred row types are noisy without a generated schema; // cast through unknown to a local shape to keep the rest of the code clean. const idea = ideaRes.data as unknown as { id: string; title: string; one_liner: string; description: string; category: string; media_url: string; lock_at: string; resolve_at: string; resolution_criteria: string | null; verification_source_type: string | null; verification_ref: unknown; result: 'success' | 'fail' | null; }; const counts = countsRes.data as unknown as | { support_count: number; pass_count: number } | null; const payload = { id: idea.id, title: idea.title, oneLiner: idea.one_liner, description: idea.description, category: idea.category, mediaUrl: idea.media_url, lockAt: idea.lock_at, resolveAt: idea.resolve_at, resolutionCriteria: idea.resolution_criteria, verificationSourceType: idea.verification_source_type, verificationRef: idea.verification_ref, result: idea.result, supportCount: counts?.support_count ?? 0, passCount: counts?.pass_count ?? 0, }; return { content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }], }; }, );