support effectful, request-aware annotations for MCP
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 32/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- backend-api-design
Línea de trabajo
Start by reading McpSchema.EnabledWhen, the tool annotation APIs, and the HTTP request scoped server setup mentioned in the issue. Work out how effectful annotations should run with authenticated request services and how their dependencies interact with shared server services, including subscriptions and legacy reverse requests. Done means a design and implementation that supports request-aware annotations with clear execution rules and tests for per-caller visibility and metadata.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What is the problem this feature would solve?
Is there any way to have the EnabledWhen from McpSchema be based on an Effect? Or another approach to achieve that behavior?
The tools we expose are based on user permissions and customer settings
~ David (Discord)
Currently its quite difficult to expose tools based on the authenticated user's permissions and customer settings. These checks can require database or service calls and if we want one shared MCP server to filter tools for each caller and check access is needed again before execution.
McpSchema.EnabledWhen currently accepts a sync predicate over protocol version, client capabilities, and client information, but it cannot run an Effect or receive authenticated request services. Checking permissions inside a handler protects execution, but the tool still appears in tools/list.
The same need can apply to other annotations. For example, a tool's title or metadata could depend on customer settings or the user's locale. Could we support effectful annotations generally, with clear rules about when they run?
What is the feature you are proposing to solve the problem?
One option is to keep .annotate for static values and add .annotateEffect for values computed when handling a request:
const JokeTool = Tool.make("DadJoke", {
parameters: Tool.EmptyParams,
success: Schema.String
})
.annotateEffect(
McpSchema.EnabledWhen,
Effect.gen(function*() {
const user = yield* CurrentUser
const permissions = yield* Permissions
const allowed = yield* permissions.hasSenseOfHumor(user)
return () => allowed
})
)
.annotateEffect(
Tool.Title,
Effect.gen(function*() {
const user = yield* CurrentUser
const settings = yield* UserSettings
return yield* settings.notSafeForWorkTitle(user.id)
})
)
The example returns a predicate because that is EnabledWhen's current value type. Allowing an effectful predicate directly could be another option, but would only address visibility.
CurrentUser, Permissions, and UserSettings are application services. Authentication provides the principal for the current request. Client-supplied MCP metadata is not proof of identity. The API would need to track these dependencies and distinguish request services from shared application services.
What alternatives have you considered?
We can load permissions with an Effect, then capture the result in EnabledWhen. For different callers, our example builds a fresh registry inside each HTTP request using Layer.fresh and McpServer.layerHttpRequestScoped.
This works, but rebuilds the registry for each request and requires sessionless clients. It does not support subscriptions or legacy reverse requests. We would like request-aware annotations without requiring this server setup.
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 11 h 24 min
- PR fusionados (30 d)
- 848
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
AI providers: tool results cannot carry images because non-string results are JSON.stringify'dPosiblemente ocupada @nmnmcc la tomó hoy. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Effect-TS/effect#9857 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
`Schema.Literals`: add `omit`, the complement of `pick`Posiblemente ocupada @effect-bot la tomó hace 1 día. Abiertoenhancement Needs Evaluation
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Support the `openapi-3.0` target in `Schema.toStandardJSONSchemaV1`Posiblemente ocupada @MichaelDeBoey la tomó hace 1 día. Abiertoenhancement Needs Evaluation
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Effect-TS/effect#9764 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
Los mantenedores suelen responder en 1 día
-
body-parser 2.3.0 in the published ai-dial-chat-bff image is vulnerable (CVE-2026-111181, HIGH)Posiblemente ocupada @illya-havsiyevych la tomó hoy. Abiertobug
Dificultad 1/5 1-3 horas Aptitud para principiantes 87/100
epam/ai-dial-chat#9566 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
はさみアイコンを修正するAbiertobug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
-
resource.reload() while params is in error switches the resource to 'idle' instead of retryingAbiertoarea: core
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día