(metadata: {
toolName?: string | null
toolDescription?: string | null
parameterSchema?: unknown
})
| 38 | } |
| 39 | |
| 40 | export 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 | |
| 55 | export function addMcpToolMetadataUsage( |
| 56 | usage: McpToolMetadataUsage, |
no test coverage detected