get_typography
Retrieve typography specifications including font families, sizes, weights, line heights, and usage guidelines for design contexts like marketing or product. Output in JSON, CSS, or SCSS.
Instructions
Get typography specifications: font families, sizes, weights, line heights, and usage guidelines per context.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Design context to query | all |
| format | No | Output format | json |
Implementation Reference
- src/tools/get-typography.ts:29-50 (handler)The main handler function for the get_typography tool. Resolves the context (marketing/product/shared/all), retrieves typography from the index, and returns output in JSON, CSS, or SCSS format.
export function handler(index: DesignSystemIndex, args: GetTypographyArgs) { const ctx = args.context ?? 'all'; const resolved = ctx === 'all' ? index.resolved.all : ctx === 'marketing' ? index.resolved.marketing : ctx === 'product' ? index.resolved.product : index.resolved.all; const typography = resolved.typography; if (typography.length === 0) { return [{ type: 'text' as const, text: `No typography specifications found in ${ctx} context.` }]; } switch (args.format) { case 'css': return [{ type: 'text' as const, text: typographyToCSSFormat(typography) }]; case 'scss': return [{ type: 'text' as const, text: typographyToSCSSFormat(typography) }]; default: return [{ type: 'text' as const, text: JSON.stringify(typography, null, 2) }]; } } - src/tools/get-typography.ts:18-24 (schema)Input schema for get_typography: accepts a 'context' enum (marketing/product/shared/all) and a 'format' enum (json/css/scss).
export const INPUT_SCHEMA = { type: 'object' as const, properties: { context: { type: 'string', enum: ['marketing', 'product', 'shared', 'all'], default: 'all', description: 'Design context to query' }, format: { type: 'string', enum: ['json', 'css', 'scss'], default: 'json', description: 'Output format' }, }, }; - src/types/mcp.ts:30-37 (schema)TypeScript interface GetTypographyArgs defining the typed arguments: optional context and format string enums.
/** Arguments for the `get_typography` MCP tool */ export interface GetTypographyArgs { /** Filter typography styles to a specific design context */ context?: 'marketing' | 'product' | 'shared' | 'all'; /** Output format for the typography list */ format?: 'json' | 'css' | 'scss'; } - src/tools/index.ts:82-83 (registration)Registration of get_typography handler in the CallToolRequestSchema switch-case, dispatching to typography.handler when TOOL_NAME matches.
case typography.TOOL_NAME: return { content: typography.handler(index, args as never) }; - src/tools/index.ts:64-70 (registration)Registration of the tool in ListToolsRequestSchema: maps ALL_TOOLS (including typography) to name/description/inputSchema for discovery.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: ALL_TOOLS.map((t) => ({ name: t.TOOL_NAME, description: t.TOOL_DESCRIPTION, inputSchema: t.INPUT_SCHEMA, })), }));