We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/m-yoshiro/storybook-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
import { getComponents, type Component } from '../storybook-api.js';
import {
ErrorCode,
McpError,
} from '@modelcontextprotocol/sdk/types.js';
import { z } from 'zod';
const GetComponentDetailsParamsSchema = z.object({
name: z.string().describe('Component name to get details for'),
});
// TODO: not implemented yet
export const getComponentDetails = async (
args: z.infer<typeof GetComponentDetailsParamsSchema> & { storybookStaticDir: string }
) => {
try {
const components = await getComponents(args.storybookStaticDir);
const componentName = args.name;
const component = components.find((c: Component) => c.name === componentName);
if (!component) {
throw new McpError(ErrorCode.MethodNotFound, `Component "${componentName}" not found`);
}
return {
content: [
{
type: 'text',
text: JSON.stringify(component, null, 2),
},
],
};
} catch (error) {
console.error('Error getting component details:', error);
if (error instanceof McpError) {
throw error;
}
throw new McpError(ErrorCode.InternalError, 'Failed to get component details');
}
};