MCPcopy Index your code
hub / github.com/simstudioai/sim / getMcpToolMetadataSizes

Function getMcpToolMetadataSizes

apps/sim/lib/mcp/tool-limits.ts:40–53  ·  view source on GitHub ↗
(metadata: {
  toolName?: string | null
  toolDescription?: string | null
  parameterSchema?: unknown
})

Source from the content-addressed store, hash-verified

38}
39
40export function getMcpToolMetadataSizes(metadata: {
41 toolName?: string | null
42 toolDescription?: string | null
43 parameterSchema?: unknown
44}): McpToolMetadataSizes {
45 return {
46 toolNameBytes: metadata.toolName ? utf8Size(metadata.toolName) : 0,
47 toolDescriptionBytes: metadata.toolDescription ? utf8Size(metadata.toolDescription) : 0,
48 parameterSchemaBytes:
49 metadata.parameterSchema !== undefined
50 ? (jsonSize(metadata.parameterSchema) ?? MAX_MCP_PARAMETER_SCHEMA_BYTES + 1)
51 : 0,
52 }
53}
54
55export function addMcpToolMetadataUsage(
56 usage: McpToolMetadataUsage,

Callers 3

addMcpToolMetadataUsageFunction · 0.85

Calls 2

utf8SizeFunction · 0.85
jsonSizeFunction · 0.85

Tested by

no test coverage detected