pull/715/head
Travis Fischer 2025-06-07 16:13:44 +07:00
rodzic 148f36d37e
commit 8ceb5663a8
4 zmienionych plików z 21 dodań i 5 usunięć

Wyświetl plik

@ -24,6 +24,7 @@
"test:unit": "vitest run" "test:unit": "vitest run"
}, },
"dependencies": { "dependencies": {
"@agentic/platform-validators": "workspace:*",
"@hono/zod-openapi": "catalog:", "@hono/zod-openapi": "catalog:",
"ms": "catalog:", "ms": "catalog:",
"type-fest": "catalog:", "type-fest": "catalog:",

Wyświetl plik

@ -1,15 +1,21 @@
import { toolNameRe } from '@agentic/platform-validators'
import { z } from '@hono/zod-openapi' import { z } from '@hono/zod-openapi'
import { pricingPlanSlugSchema } from './pricing' import { pricingPlanSlugSchema } from './pricing'
import { rateLimitSchema } from './rate-limit' import { rateLimitSchema } from './rate-limit'
// TODO: add more reserved tool names?
// TODO: if we separate mcp endpoint from REST endpoint, we may be able to have
// tools named `mcp`. would be nice not to impose a blacklist.
const toolNameBlacklist = new Set(['mcp']) const toolNameBlacklist = new Set(['mcp'])
/**
* A zod schema representing a valid
*/
export const toolNameSchema = z export const toolNameSchema = z
.string() .string()
// TODO: validate this regex constraint
.regex(/^[a-zA-Z0-9_]+$/)
.nonempty() .nonempty()
.regex(toolNameRe)
.refine( .refine(
(name) => !toolNameBlacklist.has(name), (name) => !toolNameBlacklist.has(name),
(name) => ({ (name) => ({
@ -17,6 +23,9 @@ export const toolNameSchema = z
}) })
) )
/**
* A zod schema representing any JSON Schema `object` schema.
*/
export const jsonSchemaObjectSchema = z export const jsonSchemaObjectSchema = z
.object({ .object({
type: z.literal('object'), type: z.literal('object'),
@ -152,6 +161,8 @@ export type ToolConfig = z.infer<typeof toolConfigSchema>
/** /**
* Additional properties describing a Tool to clients. * Additional properties describing a Tool to clients.
* *
* This matches MCP tool annotations 1:1.
*
* NOTE: All properties in ToolAnnotations are **hints**. * NOTE: All properties in ToolAnnotations are **hints**.
* *
* They are not guaranteed to provide a faithful description of tool behavior * They are not guaranteed to provide a faithful description of tool behavior
@ -208,6 +219,8 @@ export const toolAnnotationsSchema = z
/** /**
* Definition for an Agentic tool. * Definition for an Agentic tool.
*
* This matches MCP tool scehemas 1:1.
*/ */
export const toolSchema = z export const toolSchema = z
.object({ .object({

Wyświetl plik

@ -726,6 +726,9 @@ importers:
packages/types: packages/types:
dependencies: dependencies:
'@agentic/platform-validators':
specifier: workspace:*
version: link:../validators
'@hono/zod-openapi': '@hono/zod-openapi':
specifier: 'catalog:' specifier: 'catalog:'
version: 0.19.8(hono@4.7.11)(zod@3.25.51) version: 0.19.8(hono@4.7.11)(zod@3.25.51)

Wyświetl plik

@ -31,13 +31,11 @@
- add username / team name blacklist - add username / team name blacklist
- admin, internal, mcp, sse, etc - admin, internal, mcp, sse, etc
- API gateway - API gateway
- `cfValidateJsonSchemaObject` relax object constraint for output validation
- tool call outputs might not be objects
- keep the object validation for tool input params
- public MCP interface - public MCP interface
- MCP origin server support - MCP origin server support
- add support for custom headers on responses - add support for custom headers on responses
- how to handle binary bodies and responses? - how to handle binary bodies and responses?
- caching for MCP tool call responses
- add requestId to all JSON error responses - add requestId to all JSON error responses
- add support for `immutable` in `toolConfigs` - add support for `immutable` in `toolConfigs`
- mcp origin servers - mcp origin servers
@ -71,6 +69,7 @@
- https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare - https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare
- additional transactional emails - additional transactional emails
- consider `projectName` and `projectSlug` or `projectIdentifier`? - consider `projectName` and `projectSlug` or `projectIdentifier`?
- handle or validate against dynamic MCP origin tools
## License ## License